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(); }
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(); }
public Builder setOutputType(String outputType) { methodBuilder.setOutputType(outputType); return this; }