本文整理汇总了Java中com.google.protobuf.ExtensionRegistry.add方法的典型用法代码示例。如果您正苦于以下问题:Java ExtensionRegistry.add方法的具体用法?Java ExtensionRegistry.add怎么用?Java ExtensionRegistry.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.protobuf.ExtensionRegistry
的用法示例。
在下文中一共展示了ExtensionRegistry.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseFrom
import com.google.protobuf.ExtensionRegistry; //导入方法依赖的package包/类
public static ValuePartition parseFrom(final byte[] bytes) throws DeserializationException {
ValuePartitionProtos.ValuePartition valuePartition = null;
try {
ExtensionRegistry registry = ExtensionRegistry.newInstance();
registry
.add(org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SpatialPartition.offset);
registry
.add(org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SpatialPartition.length);
valuePartition =
ValuePartitionProtos.ValuePartition.newBuilder().mergeFrom(bytes, registry).build();
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
return new SpatialPartition(
valuePartition
.getExtension(org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SpatialPartition.offset),
valuePartition
.getExtension(org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SpatialPartition.length));
}
示例2: parseFrom
import com.google.protobuf.ExtensionRegistry; //导入方法依赖的package包/类
public static ValuePartition parseFrom(final byte[] bytes) throws DeserializationException {
ValuePartitionProtos.ValuePartition valuePartition;
try {
ExtensionRegistry registry = ExtensionRegistry.newInstance();
registry
.add(org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SeparatorPartition.separator);
registry
.add(org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SeparatorPartition.position);
valuePartition = ValuePartitionProtos.ValuePartition.parseFrom(bytes, registry);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
return new SeparatorPartition(
valuePartition
.getExtension(
org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SeparatorPartition.separator)
.toByteArray(),
valuePartition
.getExtension(org.apache.hadoop.hbase.index.protobuf.generated.ValuePartitionProtos.SeparatorPartition.position));
}
示例3: createExtensionRegistry
import com.google.protobuf.ExtensionRegistry; //导入方法依赖的package包/类
public static ExtensionRegistry createExtensionRegistry(Map<String, Set<Descriptors.FieldDescriptor>> extensionMap) {
ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
for(Map.Entry<String, Set<Descriptors.FieldDescriptor>> e : extensionMap.entrySet()) {
Set<Descriptors.FieldDescriptor> value = e.getValue();
for (Descriptors.FieldDescriptor f : value) {
extensionRegistry.add(f);
}
}
return extensionRegistry;
}
示例4: addToRegistry
import com.google.protobuf.ExtensionRegistry; //导入方法依赖的package包/类
/**
* Adds extension to the registry, making a default DynamicMessage if its type is a Message.
*/
public static ExtensionRegistry addToRegistry(final FieldDescriptor extension,
final ExtensionRegistry registry) {
if (extension.getJavaType() == JavaType.MESSAGE) {
registry.add(extension, DynamicMessage.getDefaultInstance(extension.getMessageType()));
} else {
registry.add(extension);
}
return registry;
}
示例5: readStudy
import com.google.protobuf.ExtensionRegistry; //导入方法依赖的package包/类
private Pair<BaseStudy, List<Attachment>> readStudy(InputStream inputStream) throws IOException {
Mica.StudyDto.Builder builder = Mica.StudyDto.newBuilder();
Readable input = new InputStreamReader(inputStream, Charsets.UTF_8);
ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
extensionRegistry .add(Mica.CollectionStudyDto.type);
extensionRegistry .add(Mica.HarmonizationStudyDto.type);
JsonFormat.merge(input, extensionRegistry, builder);
List<Attachment> atts = extractAttachments(builder);
BaseStudy study = dtos.fromDto( builder);
return Pair.create(study, atts);
}
示例6: buildExtensionRegistry
import com.google.protobuf.ExtensionRegistry; //导入方法依赖的package包/类
private ExtensionRegistry buildExtensionRegistry(){
ExtensionRegistry er = ExtensionRegistry.newInstance();
er.add(OlapMessage.Submit.command);
er.add(OlapMessage.Status.command);
er.add(OlapMessage.Cancel.command);
return er;
}
示例7: buildExtensionRegistry
import com.google.protobuf.ExtensionRegistry; //导入方法依赖的package包/类
private ExtensionRegistry buildExtensionRegistry(){
ExtensionRegistry er=ExtensionRegistry.newInstance();
er.add(OlapMessage.FailedResponse.response);
er.add(OlapMessage.CancelledResponse.response);
er.add(OlapMessage.ProgressResponse.response);
er.add(OlapMessage.Result.response);
return er;
}