当前位置: 首页>>代码示例>>Java>>正文


Java ExtensionRegistry.add方法代码示例

本文整理汇总了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));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:20,代码来源:SpatialPartition.java

示例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));
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:SeparatorPartition.java

示例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;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:11,代码来源:ProtobufTestUtil.java

示例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;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:14,代码来源:ExtensionRegistries.java

示例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);
}
 
开发者ID:obiba,项目名称:mica2,代码行数:12,代码来源:StudyPackageImportServiceImpl.java

示例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;
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:8,代码来源:OlapPipelineFactory.java

示例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;
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:9,代码来源:AsyncOlapNIOLayer.java


注:本文中的com.google.protobuf.ExtensionRegistry.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。