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


Java ServiceDescriptorProto.Builder方法代码示例

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


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

示例1: makeCanonicalProto

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private FileDescriptorProto makeCanonicalProto(final FileDescriptor fileDescriptor) {
  final FileDescriptorProto.Builder protoBuilder =
      FileDescriptorProto.newBuilder(fileDescriptor.toProto());

  for (final FieldDescriptorProto.Builder field : protoBuilder.getExtensionBuilderList()) {
    makeCanonicalField(field, fileDescriptor.findExtensionByName(field.getName()));
  }

  for (final DescriptorProto.Builder message : protoBuilder.getMessageTypeBuilderList()) {
    makeCanonicalMessage(message, fileDescriptor.findMessageTypeByName(message.getName()));
  }

  // for (EnumDescriptorProto.Builder enumProto :
  // protoBuilder.getEnumTypeBuilderList()) {
  // makeCanonicalEnum(enumProto,
  // fileDescriptor.findEnumTypeByName(enumProto.getName()));
  // }

  for (final ServiceDescriptorProto.Builder serviceProto : protoBuilder.getServiceBuilderList()) {
    makeCanonicalService(serviceProto, fileDescriptor.findServiceByName(serviceProto.getName()));
  }

  // TODO: incorporate options' tree walking into canonicalization to eliminate double walking
  return OptionResolver.newBuilder().setCustomOptionsAsExtensions(false)
      .resolveAllOptionsFor(fileDescriptor, protoBuilder).build();
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:27,代码来源:FileDescriptors.java

示例2: buildAllOptions

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private void buildAllOptions(final FileDescriptorProto.Builder proto) {
  if (!buildOptions(proto.getOptionsBuilder())) {
    proto.clearOptions();
  }

  for (final FieldDescriptorProto.Builder extensionProto : proto.getExtensionBuilderList()) {
    if (!buildOptions(extensionProto.getOptionsBuilder())) {
      extensionProto.clearOptions();
    }
  }

  for (final EnumDescriptorProto.Builder enumProto : proto.getEnumTypeBuilderList()) {
    buildAllOptions(enumProto);
  }

  for (final ServiceDescriptorProto.Builder serviceProto : proto.getServiceBuilderList()) {
    buildAllOptions(serviceProto);
  }

  for (final DescriptorProto.Builder messageProto : proto.getMessageTypeBuilderList()) {
    buildAllOptions(messageProto);
  }
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:24,代码来源:OptionResolver.java

示例3: makeCanonicalProto

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private FileDescriptorProto makeCanonicalProto(final FileDescriptor file) {
  final FileDescriptorProto.Builder protoBuilder = FileDescriptorProto.newBuilder(file.toProto());

  for (final FieldDescriptorProto.Builder field : protoBuilder.getExtensionBuilderList()) {
    makeCanonicalField(field, file.findExtensionByName(field.getName()));
  }

  for (final DescriptorProto.Builder message : protoBuilder.getMessageTypeBuilderList()) {
    makeCanonicalMessage(message, file.findMessageTypeByName(message.getName()));
  }

  // for (EnumDescriptorProto.Builder enumProto :
  // protoBuilder.getEnumTypeBuilderList()) {
  // makeCanonicalEnum(enumProto,
  // file.findEnumTypeByName(enumProto.getName()));
  // }

  for (final ServiceDescriptorProto.Builder serviceProto : protoBuilder.getServiceBuilderList()) {
    makeCanonicalService(serviceProto, file.findServiceByName(serviceProto.getName()));
  }

  return OptionResolver.newBuilder().setCustomOptionsAsExtensions(reparseCustomOptions)
      .resolveAllOptionsFor(file, protoBuilder).build();
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:25,代码来源:FileDescriptorEx.java

示例4: generateApi

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private ServiceDescriptorProto generateApi(Api api) {
  ServiceDescriptorProto.Builder builder = ServiceDescriptorProto.newBuilder();
  builder.setName(getSimpleName(api.getName()));
  for (Method method : api.getMethodsList()) {
    builder.addMethod(generateMethod(method));
  }
  if (!api.getOptionsList().isEmpty()) {
    builder.setOptions(generateServiceOptions(api));
  }
  return builder.build();
}
 
开发者ID:googleapis,项目名称:api-compiler,代码行数:12,代码来源:DescriptorGenerator.java

示例5: accept

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
@Accepts
protected void accept(ServiceDescriptorProto.Builder service) {
  pushParent(BuilderVisitorNodeInfo.create(service, currentFile));
  visitRepeated(ServiceDescriptorProto.METHOD_FIELD_NUMBER);
  visit(service.getOptionsBuilder());
  popExpectedParent(service);
}
 
开发者ID:googleapis,项目名称:api-compiler,代码行数:8,代码来源:BuilderVisitor.java

示例6: makeCanonicalService

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private void makeCanonicalService(final ServiceDescriptorProto.Builder service,
    final ServiceDescriptor serviceDescriptor) {
  for (final MethodDescriptorProto.Builder method : service.getMethodBuilderList()) {
    final MethodDescriptor methodDescriptor =
        serviceDescriptor.findMethodByName(method.getName());
    method.setInputType(ensureLeadingDot(methodDescriptor.getInputType().getFullName()));
    method.setOutputType(ensureLeadingDot(methodDescriptor.getOutputType().getFullName()));
  }
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:10,代码来源:FileDescriptors.java

示例7: exitService

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
@Override
public void exitService(final ServiceContext ctx) {
  final ServiceDescriptorProto.Builder serviceBuilder =
      ServiceDescriptorProto.Builder.class.cast(scopes.getProtoBuilder());
  serviceBuilder.setName(ctx.identifier().getText());
  scopes.popScope();
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:8,代码来源:ProtoFileParser.java

示例8: addService

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
public ServiceDescriptorProto.Builder addService() {
  final ServiceDescriptorProto.Builder builder = currentScope.addService();
  pushScope(new ServiceScope(builder, currentScope));
  return builder;
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:6,代码来源:Scopes.java

示例9: ServiceScope

import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto; //导入方法依赖的package包/类
private ServiceScope(final ServiceDescriptorProto.Builder protoBuilder, final Scope<?> parent) {
  super(protoBuilder, parent);
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:4,代码来源:Scopes.java


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