/** Prints google.protobuf.Value */
private void printValue(MessageOrBuilder message) throws IOException {
// For a Value message, only the value of the field is formatted.
Map<FieldDescriptor, Object> fields = message.getAllFields();
if (fields.isEmpty()) {
// No value set.
generator.print("null");
return;
}
// A Value message can only have at most one field set (it only contains
// an oneof).
if (fields.size() != 1) {
throw new InvalidProtocolBufferException("Invalid Value type.");
}
for (Map.Entry<FieldDescriptor, Object> entry : fields.entrySet()) {
printSingleFieldValue(entry.getKey(), entry.getValue());
}
}
JsonFormat.java 文件源码
java
阅读 40
收藏 0
点赞 0
评论 0
项目:seldon-core
作者:
评论列表
文章目录