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


Java DescriptorProto.getNestedType方法代码示例

本文整理汇总了Java中com.google.protobuf.DescriptorProtos.DescriptorProto.getNestedType方法的典型用法代码示例。如果您正苦于以下问题:Java DescriptorProto.getNestedType方法的具体用法?Java DescriptorProto.getNestedType怎么用?Java DescriptorProto.getNestedType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.protobuf.DescriptorProtos.DescriptorProto的用法示例。


在下文中一共展示了DescriptorProto.getNestedType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: appendToFullName

import com.google.protobuf.DescriptorProtos.DescriptorProto; //导入方法依赖的package包/类
private static Optional<String> appendToFullName(
        DescriptorProto messageDescriptor, List<Integer> path, String fullNameSoFar) {
    switch (path.get(0)) {
        case DescriptorProto.NESTED_TYPE_FIELD_NUMBER:
            DescriptorProto nestedMessage = messageDescriptor.getNestedType(path.get(1));
            return appendMessageToFullName(nestedMessage, path, fullNameSoFar);
        case DescriptorProto.ENUM_TYPE_FIELD_NUMBER:
            EnumDescriptorProto enumDescriptor = messageDescriptor.getEnumType(path.get(1));
            return Optional.of(appendEnumToFullName(enumDescriptor, path, fullNameSoFar));
        case DescriptorProto.FIELD_FIELD_NUMBER:
            FieldDescriptorProto fieldDescriptor = messageDescriptor.getField(path.get(1));
            return Optional.of(appendFieldComponent(fullNameSoFar, fieldDescriptor.getName()));
        default:
            return Optional.empty();
    }
}
 
开发者ID:line,项目名称:armeria,代码行数:17,代码来源:GrpcDocStringExtractor.java

示例2: add

import com.google.protobuf.DescriptorProtos.DescriptorProto; //导入方法依赖的package包/类
private void add(DescriptorProto message) {
  fullNameSegments.push(message.getName());
  pathSegments.push(DescriptorProto.EXTENSION_FIELD_NUMBER);
  add(message.getExtensionList());
  pathSegments.pop();
  pathSegments.push(DescriptorProto.NESTED_TYPE_FIELD_NUMBER);
  for (int i = 0; i < message.getNestedTypeCount(); i++) {
    pathSegments.push(i);
    DescriptorProto nested = message.getNestedType(i);
    add(nested);
    pathSegments.pop();
  }
  pathSegments.pop();
  fullNameSegments.pop();
}
 
开发者ID:googleapis,项目名称:api-compiler,代码行数:16,代码来源:ExtensionPool.java

示例3: Descriptor

import com.google.protobuf.DescriptorProtos.DescriptorProto; //导入方法依赖的package包/类
private Descriptor(final DescriptorProto proto,
                   final FileDescriptor file,
                   final Descriptor parent,
                   final int index)
            throws DescriptorValidationException {
  this.index = index;
  this.proto = proto;
  fullName = computeFullName(file, parent, proto.getName());
  this.file = file;
  containingType = parent;

  oneofs = new OneofDescriptor[proto.getOneofDeclCount()];
  for (int i = 0; i < proto.getOneofDeclCount(); i++) {
    oneofs[i] = new OneofDescriptor(
      proto.getOneofDecl(i), file, this, i);
  }

  nestedTypes = new Descriptor[proto.getNestedTypeCount()];
  for (int i = 0; i < proto.getNestedTypeCount(); i++) {
    nestedTypes[i] = new Descriptor(
      proto.getNestedType(i), file, this, i);
  }

  enumTypes = new EnumDescriptor[proto.getEnumTypeCount()];
  for (int i = 0; i < proto.getEnumTypeCount(); i++) {
    enumTypes[i] = new EnumDescriptor(
      proto.getEnumType(i), file, this, i);
  }

  fields = new FieldDescriptor[proto.getFieldCount()];
  for (int i = 0; i < proto.getFieldCount(); i++) {
    fields[i] = new FieldDescriptor(
      proto.getField(i), file, this, i, false);
  }

  extensions = new FieldDescriptor[proto.getExtensionCount()];
  for (int i = 0; i < proto.getExtensionCount(); i++) {
    extensions[i] = new FieldDescriptor(
      proto.getExtension(i), file, this, i, true);
  }

  for (int i = 0; i < proto.getOneofDeclCount(); i++) {
    oneofs[i].fields = new FieldDescriptor[oneofs[i].getFieldCount()];
    oneofs[i].fieldCount = 0;
  }
  for (int i = 0; i < proto.getFieldCount(); i++) {
    OneofDescriptor oneofDescriptor = fields[i].getContainingOneof();
    if (oneofDescriptor != null) {
      oneofDescriptor.fields[oneofDescriptor.fieldCount++] = fields[i];
    }
  }

  file.pool.addSymbol(this);
}
 
开发者ID:yeriomin,项目名称:play-store-api,代码行数:55,代码来源:Descriptors.java

示例4: Descriptor

import com.google.protobuf.DescriptorProtos.DescriptorProto; //导入方法依赖的package包/类
private Descriptor (final DescriptorProto proto,
        final FileDescriptor file,
        final Descriptor parent,
        final int index)
        throws DescriptorValidationException {
    this.index = index;
    this.proto = proto;
    fullName = computeFullName (file, parent, proto.getName ());
    this.file = file;
    containingType = parent;

    oneofs = new OneofDescriptor[proto.getOneofDeclCount ()];
    for (int i = 0; i < proto.getOneofDeclCount (); i++) {
        oneofs[i] = new OneofDescriptor (
                proto.getOneofDecl (i), file, this, i);
    }

    nestedTypes = new Descriptor[proto.getNestedTypeCount ()];
    for (int i = 0; i < proto.getNestedTypeCount (); i++) {
        nestedTypes[i] = new Descriptor (
                proto.getNestedType (i), file, this, i);
    }

    enumTypes = new EnumDescriptor[proto.getEnumTypeCount ()];
    for (int i = 0; i < proto.getEnumTypeCount (); i++) {
        enumTypes[i] = new EnumDescriptor (
                proto.getEnumType (i), file, this, i);
    }

    fields = new FieldDescriptor[proto.getFieldCount ()];
    for (int i = 0; i < proto.getFieldCount (); i++) {
        fields[i] = new FieldDescriptor (
                proto.getField (i), file, this, i, false);
    }

    extensions = new FieldDescriptor[proto.getExtensionCount ()];
    for (int i = 0; i < proto.getExtensionCount (); i++) {
        extensions[i] = new FieldDescriptor (
                proto.getExtension (i), file, this, i, true);
    }

    for (int i = 0; i < proto.getOneofDeclCount (); i++) {
        oneofs[i].fields = new FieldDescriptor[oneofs[i].getFieldCount ()];
        oneofs[i].fieldCount = 0;
    }
    for (int i = 0; i < proto.getFieldCount (); i++) {
        OneofDescriptor oneofDescriptor = fields[i].getContainingOneof ();
        if (oneofDescriptor != null) {
            oneofDescriptor.fields[oneofDescriptor.fieldCount++] = fields[i];
        }
    }

    file.pool.addSymbol (this);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:55,代码来源:Descriptors.java


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