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 setServerStreaming(boolean flag) { methodBuilder.setServerStreaming(flag); return this; }
public Builder mergeFrom(com.google.protobuf.DescriptorProtos.MethodDescriptorProto other) { if (other == com.google.protobuf.DescriptorProtos.MethodDescriptorProto.getDefaultInstance()) return this; if (other.hasName()) { bitField0_ |= 0x00000001; name_ = other.name_; onChanged(); } if (other.hasInputType()) { bitField0_ |= 0x00000002; inputType_ = other.inputType_; onChanged(); } if (other.hasOutputType()) { bitField0_ |= 0x00000004; outputType_ = other.outputType_; onChanged(); } if (other.hasOptions()) { mergeOptions(other.getOptions()); } if (other.hasClientStreaming()) { setClientStreaming(other.getClientStreaming()); } if (other.hasServerStreaming()) { setServerStreaming(other.getServerStreaming()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }