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


Java MethodDescriptorProto.Builder方法代码示例

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


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

示例1: generateMethod

import com.google.protobuf.DescriptorProtos.MethodDescriptorProto; //导入方法依赖的package包/类
private MethodDescriptorProto generateMethod(Method method) {
  MethodDescriptorProto.Builder builder = MethodDescriptorProto.newBuilder();
  builder.setName(method.getName());
  builder.setInputType(getTypeName(method.getRequestTypeUrl()));
  builder.setOutputType(getTypeName(method.getResponseTypeUrl()));
  builder.setOptions(generateMethodOptions(method));
  builder.setClientStreaming(method.getRequestStreaming());
  // protoc set serverStreaming field as false for legacy streaming options,
  // but google.protobuf.Method set the responseStreaming field to true for both new and legacy
  // streaming setup. So we need to distinguish streaming style while generating
  // MethodDescriptorProto.
  // But we cannot distinguish if the new and old styles are both set which should be rare case.
  if (method.getResponseStreaming() && isLegacyStreaming(method)) {
    builder.setServerStreaming(false);
  } else {
    builder.setServerStreaming(method.getResponseStreaming());
  }
  return builder.build();
}
 
开发者ID:googleapis,项目名称:api-compiler,代码行数:20,代码来源:DescriptorGenerator.java

示例2: makeCanonicalService

import com.google.protobuf.DescriptorProtos.MethodDescriptorProto; //导入方法依赖的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

示例3: exitMethodStatement

import com.google.protobuf.DescriptorProtos.MethodDescriptorProto; //导入方法依赖的package包/类
@Override
public void exitMethodStatement(final MethodStatementContext ctx) {
  final MethodDescriptorProto.Builder methodBuilder =
      MethodDescriptorProto.Builder.class.cast(scopes.getProtoBuilder());
  methodBuilder.setName(ctx.identifier().getText()).setInputType(ctx.extendedId(0).getText())
      .setOutputType(ctx.extendedId(1).getText());
  scopes.popScope();
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:9,代码来源:ProtoFileParser.java

示例4: buildAllOptions

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

  for (final MethodDescriptorProto.Builder methodProto : proto.getMethodBuilderList()) {
    if (!buildOptions(methodProto.getOptionsBuilder())) {
      methodProto.clearOptions();
    }
  }
}
 
开发者ID:protobufel,项目名称:protobuf-el,代码行数:12,代码来源:OptionResolver.java

示例5: accept

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

示例6: addMethod

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

示例7: MethodScope

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


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