本文整理汇总了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();
}
示例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()));
}
}
示例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();
}
示例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();
}
}
}
示例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);
}
示例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;
}
示例7: MethodScope
import com.google.protobuf.DescriptorProtos.MethodDescriptorProto; //导入方法依赖的package包/类
private MethodScope(final MethodDescriptorProto.Builder protoBuilder, final Scope<?> parent) {
super(protoBuilder, parent);
}