Get rid of AbstractServiceDescriptor as it is no longer useful
diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp
index 07af2f1..7bff09d 100644
--- a/compiler/src/java_plugin/cpp/java_generator.cpp
+++ b/compiler/src/java_plugin/cpp/java_generator.cpp
@@ -62,6 +62,7 @@
static void PrintMethodFields(
const ServiceDescriptor* service, map<string, string>* vars, Printer* p,
bool generate_nano) {
+ p->Print("// Static method descriptors that strictly reflect the proto.\n");
(*vars)["service_name"] = service->name();
for (int i = 0; i < service->method_count(); ++i) {
const MethodDescriptor* method = service->method(i);
@@ -85,8 +86,6 @@
}
}
- p->Print("// Static method descriptors that strictly reflect the proto.\n");
-
if (generate_nano) {
// TODO(zsurocking): we're creating two Parsers for each method right now.
// We could instead create static Parsers and reuse them if some methods
@@ -129,105 +128,6 @@
p->Print("\n");
}
-static void PrintServiceDescriptor(
- const ServiceDescriptor* service, map<string, string>* vars, Printer* p) {
- (*vars)["service_name"] = service->name();
- p->Print(
- *vars,
- "@$Immutable$\n");
- p->Print(
- *vars,
- "public static class $service_name$ServiceDescriptor extends\n"
- " $AbstractServiceDescriptor$<$service_name$ServiceDescriptor> {\n");
- p->Indent();
-
- // Service descriptor fields
- for (int i = 0; i < service->method_count(); ++i) {
- const MethodDescriptor* method = service->method(i);
- (*vars)["input_type"] = MessageFullJavaName(method->input_type());
- (*vars)["output_type"] = MessageFullJavaName(method->output_type());
- (*vars)["lower_method_name"] = LowerMethodName(method);
- p->Print(
- *vars,
- "public final $MethodDescriptor$<$input_type$,\n"
- " $output_type$> $lower_method_name$;\n");
- }
-
- // The default constructor
- p->Print(
- *vars,
- "\nprivate $service_name$ServiceDescriptor() {\n");
- p->Indent();
- for (int i = 0; i < service->method_count(); ++i) {
- const MethodDescriptor* method = service->method(i);
- (*vars)["method_field_name"] = MethodPropertiesFieldName(method);
- (*vars)["lower_method_name"] = LowerMethodName(method);
- p->Print(*vars,
- "$lower_method_name$ = $method_field_name$;\n");
- }
- p->Outdent();
- p->Print("}\n");
-
- // The reconfiguring constructor
- p->Print(
- *vars,
- "\n@SuppressWarnings(\"unchecked\")\n"
- "private $service_name$ServiceDescriptor(\n"
- " $Map$<$String$, $MethodDescriptor$<?, ?>> methodMap) {\n");
- p->Indent();
- for (int i = 0; i < service->method_count(); ++i) {
- const MethodDescriptor* method = service->method(i);
- (*vars)["input_type"] = MessageFullJavaName(method->input_type());
- (*vars)["output_type"] = MessageFullJavaName(method->output_type());
- (*vars)["lower_method_name"] = LowerMethodName(method);
- (*vars)["method_field_name"] = MethodPropertiesFieldName(method);
- p->Print(
- *vars,
- "$lower_method_name$ = ($MethodDescriptor$<$input_type$,\n"
- " $output_type$>) methodMap.get(\n"
- " CONFIG.$lower_method_name$.getFullMethodName());\n");
- }
- p->Outdent();
- p->Print("}\n\n");
-
- p->Print(
- *vars,
- "@$Override$\nprotected $service_name$ServiceDescriptor build(\n"
- " $Map$<$String$, $MethodDescriptor$<?, ?>> methodMap) {\n");
- p->Indent();
- p->Print(
- *vars,
- "return new $service_name$ServiceDescriptor(methodMap);\n");
- p->Outdent();
- p->Print("}\n\n");
-
- p->Print(
- *vars,
- "@$Override$\n"
- "public $Collection$<$MethodDescriptor$<?, ?>> methods() {\n");
- p->Indent();
- p->Print(
- *vars,
- "return $ImmutableList$.<$MethodDescriptor$<?, ?>>of(\n");
- p->Indent();
- p->Indent();
- for (int i = 0; i < service->method_count(); ++i) {
- p->Print(MixedLower(service->method(i)->name()).c_str());
- if (i < service->method_count() - 1) {
- p->Print(",\n");
- } else {
- p->Print(");\n");
- }
- }
- p->Outdent();
- p->Outdent();
- p->Outdent();
- p->Print("}\n");
-
- p->Outdent();
- p->Print("}\n\n");
-}
-
enum StubType {
ASYNC_INTERFACE = 0,
BLOCKING_CLIENT_INTERFACE = 1,
@@ -314,8 +214,7 @@
} else {
p->Print(
*vars,
- "public static class $impl_name$ extends\n"
- " $AbstractStub$<$impl_name$, $service_name$ServiceDescriptor>\n"
+ "public static class $impl_name$ extends $AbstractStub$<$impl_name$>\n"
" implements $interface_name$ {\n");
}
p->Indent();
@@ -324,31 +223,28 @@
if (impl) {
p->Print(
*vars,
- "private $impl_name$($Channel$ channel,\n"
- " $service_name$ServiceDescriptor config) {\n");
+ "private $impl_name$($Channel$ channel) {\n");
p->Indent();
- p->Print("super(channel, config);\n");
+ p->Print("super(channel);\n");
p->Outdent();
p->Print("}\n\n");
p->Print(
*vars,
"private $impl_name$($Channel$ channel,\n"
- " $service_name$ServiceDescriptor config,\n"
" $CallOptions$ callOptions) {\n");
p->Indent();
- p->Print("super(channel, config, callOptions);\n");
+ p->Print("super(channel, callOptions);\n");
p->Outdent();
p->Print("}\n\n");
p->Print(
*vars,
"@$Override$\n"
"protected $impl_name$ build($Channel$ channel,\n"
- " $service_name$ServiceDescriptor config,\n"
" $CallOptions$ callOptions) {\n");
p->Indent();
p->Print(
*vars,
- "return new $impl_name$(channel, config, callOptions);\n");
+ "return new $impl_name$(channel, callOptions);\n");
p->Outdent();
p->Print("}\n");
}
@@ -359,6 +255,7 @@
(*vars)["input_type"] = MessageFullJavaName(method->input_type());
(*vars)["output_type"] = MessageFullJavaName(method->output_type());
(*vars)["lower_method_name"] = LowerMethodName(method);
+ (*vars)["method_field_name"] = MethodPropertiesFieldName(method);
bool client_streaming = method->client_streaming();
bool server_streaming = method->server_streaming();
@@ -444,7 +341,7 @@
p->Print(
*vars,
"return $calls_method$(\n"
- " channel.newCall(config.$lower_method_name$, callOptions), $params$);\n");
+ " channel.newCall($method_field_name$, callOptions), $params$);\n");
break;
case ASYNC_CALL:
if (server_streaming) {
@@ -468,7 +365,7 @@
p->Print(
*vars,
"$last_line_prefix$$calls_method$(\n"
- " channel.newCall(config.$lower_method_name$, callOptions), $params$);\n");
+ " channel.newCall($method_field_name$, callOptions), $params$);\n");
break;
case FUTURE_CALL:
CHECK(!client_streaming && !server_streaming)
@@ -479,7 +376,7 @@
p->Print(
*vars,
"return $calls_method$(\n"
- " channel.newCall(config.$lower_method_name$, callOptions), request);\n");
+ " channel.newCall($method_field_name$, callOptions), request);\n");
break;
}
p->Outdent();
@@ -602,7 +499,7 @@
p->Indent();
p->Print(
*vars,
- "return new $service_name$Stub(channel, CONFIG);\n");
+ "return new $service_name$Stub(channel);\n");
p->Outdent();
p->Print("}\n\n");
p->Print(
@@ -612,7 +509,7 @@
p->Indent();
p->Print(
*vars,
- "return new $service_name$BlockingStub(channel, CONFIG);\n");
+ "return new $service_name$BlockingStub(channel);\n");
p->Outdent();
p->Print("}\n\n");
p->Print(
@@ -622,16 +519,10 @@
p->Indent();
p->Print(
*vars,
- "return new $service_name$FutureStub(channel, CONFIG);\n");
+ "return new $service_name$FutureStub(channel);\n");
p->Outdent();
p->Print("}\n\n");
- p->Print("// The default service descriptor\n");
- p->Print(
- *vars,
- "private static final $service_name$ServiceDescriptor CONFIG =\n"
- " new $service_name$ServiceDescriptor();\n\n");
- PrintServiceDescriptor(service, vars, p);
PrintStub(service, vars, p, ASYNC_INTERFACE);
PrintStub(service, vars, p, BLOCKING_CLIENT_INTERFACE);
PrintStub(service, vars, p, FUTURE_CLIENT_INTERFACE);
@@ -688,8 +579,6 @@
vars["ServerServiceDefinition"] =
"io.grpc.ServerServiceDefinition";
vars["AbstractStub"] = "io.grpc.stub.AbstractStub";
- vars["AbstractServiceDescriptor"] =
- "io.grpc.stub.AbstractServiceDescriptor";
vars["ImmutableList"] = "com.google.common.collect.ImmutableList";
vars["Collection"] = "java.util.Collection";
vars["MethodDescriptor"] = "io.grpc.MethodDescriptor";
diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt
index 78c11c1..dcf1d83 100644
--- a/compiler/src/test/golden/TestService.java.txt
+++ b/compiler/src/test/golden/TestService.java.txt
@@ -23,7 +23,6 @@
"grpc.testing.TestService", "UnaryCall",
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.SimpleRequest.parser()),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.SimpleResponse.parser()));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
io.grpc.MethodDescriptor.create(
@@ -31,7 +30,6 @@
"grpc.testing.TestService", "StreamingOutputCall",
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.parser()),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.parser()));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
io.grpc.MethodDescriptor.create(
@@ -39,7 +37,6 @@
"grpc.testing.TestService", "StreamingInputCall",
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallRequest.parser()),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingInputCallResponse.parser()));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_DUPLEX_CALL =
io.grpc.MethodDescriptor.create(
@@ -47,7 +44,6 @@
"grpc.testing.TestService", "FullDuplexCall",
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallRequest.parser()),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.parser()));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_DUPLEX_CALL =
io.grpc.MethodDescriptor.create(
@@ -57,80 +53,17 @@
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Test.StreamingOutputCallResponse.parser()));
public static TestServiceStub newStub(io.grpc.Channel channel) {
- return new TestServiceStub(channel, CONFIG);
+ return new TestServiceStub(channel);
}
public static TestServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
- return new TestServiceBlockingStub(channel, CONFIG);
+ return new TestServiceBlockingStub(channel);
}
public static TestServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
- return new TestServiceFutureStub(channel, CONFIG);
- }
-
- // The default service descriptor
- private static final TestServiceServiceDescriptor CONFIG =
- new TestServiceServiceDescriptor();
-
- @javax.annotation.concurrent.Immutable
- public static class TestServiceServiceDescriptor extends
- io.grpc.stub.AbstractServiceDescriptor<TestServiceServiceDescriptor> {
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
- io.grpc.testing.integration.Test.SimpleResponse> unaryCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.Test.StreamingInputCallResponse> streamingInputCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> fullDuplexCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> halfDuplexCall;
-
- private TestServiceServiceDescriptor() {
- unaryCall = METHOD_UNARY_CALL;
- streamingOutputCall = METHOD_STREAMING_OUTPUT_CALL;
- streamingInputCall = METHOD_STREAMING_INPUT_CALL;
- fullDuplexCall = METHOD_FULL_DUPLEX_CALL;
- halfDuplexCall = METHOD_HALF_DUPLEX_CALL;
- }
-
- @SuppressWarnings("unchecked")
- private TestServiceServiceDescriptor(
- java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
- unaryCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
- io.grpc.testing.integration.Test.SimpleResponse>) methodMap.get(
- CONFIG.unaryCall.getFullMethodName());
- streamingOutputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
- CONFIG.streamingOutputCall.getFullMethodName());
- streamingInputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.Test.StreamingInputCallResponse>) methodMap.get(
- CONFIG.streamingInputCall.getFullMethodName());
- fullDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
- CONFIG.fullDuplexCall.getFullMethodName());
- halfDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
- CONFIG.halfDuplexCall.getFullMethodName());
- }
-
- @java.lang.Override
- protected TestServiceServiceDescriptor build(
- java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
- return new TestServiceServiceDescriptor(methodMap);
- }
-
- @java.lang.Override
- public java.util.Collection<io.grpc.MethodDescriptor<?, ?>> methods() {
- return com.google.common.collect.ImmutableList.<io.grpc.MethodDescriptor<?, ?>>of(
- unaryCall,
- streamingOutputCall,
- streamingInputCall,
- fullDuplexCall,
- halfDuplexCall);
- }
+ return new TestServiceFutureStub(channel);
}
public static interface TestService {
@@ -165,124 +98,112 @@
io.grpc.testing.integration.Test.SimpleRequest request);
}
- public static class TestServiceStub extends
- io.grpc.stub.AbstractStub<TestServiceStub, TestServiceServiceDescriptor>
+ public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
implements TestService {
- private TestServiceStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config) {
- super(channel, config);
+ private TestServiceStub(io.grpc.Channel channel) {
+ super(channel);
}
private TestServiceStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- super(channel, config, callOptions);
+ super(channel, callOptions);
}
@java.lang.Override
protected TestServiceStub build(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- return new TestServiceStub(channel, config, callOptions);
+ return new TestServiceStub(channel, callOptions);
}
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnaryCall(
- channel.newCall(config.unaryCall, callOptions), request, responseObserver);
+ channel.newCall(METHOD_UNARY_CALL, callOptions), request, responseObserver);
}
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
- channel.newCall(config.streamingOutputCall, callOptions), request, responseObserver);
+ channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncClientStreamingCall(
- channel.newCall(config.streamingInputCall, callOptions), responseObserver);
+ channel.newCall(METHOD_STREAMING_INPUT_CALL, callOptions), responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncDuplexStreamingCall(
- channel.newCall(config.fullDuplexCall, callOptions), responseObserver);
+ channel.newCall(METHOD_FULL_DUPLEX_CALL, callOptions), responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncDuplexStreamingCall(
- channel.newCall(config.halfDuplexCall, callOptions), responseObserver);
+ channel.newCall(METHOD_HALF_DUPLEX_CALL, callOptions), responseObserver);
}
}
- public static class TestServiceBlockingStub extends
- io.grpc.stub.AbstractStub<TestServiceBlockingStub, TestServiceServiceDescriptor>
+ public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
implements TestServiceBlockingClient {
- private TestServiceBlockingStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config) {
- super(channel, config);
+ private TestServiceBlockingStub(io.grpc.Channel channel) {
+ super(channel);
}
private TestServiceBlockingStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- super(channel, config, callOptions);
+ super(channel, callOptions);
}
@java.lang.Override
protected TestServiceBlockingStub build(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- return new TestServiceBlockingStub(channel, config, callOptions);
+ return new TestServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
return blockingUnaryCall(
- channel.newCall(config.unaryCall, callOptions), request);
+ channel.newCall(METHOD_UNARY_CALL, callOptions), request);
}
@java.lang.Override
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
- channel.newCall(config.streamingOutputCall, callOptions), request);
+ channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request);
}
}
- public static class TestServiceFutureStub extends
- io.grpc.stub.AbstractStub<TestServiceFutureStub, TestServiceServiceDescriptor>
+ public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
implements TestServiceFutureClient {
- private TestServiceFutureStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config) {
- super(channel, config);
+ private TestServiceFutureStub(io.grpc.Channel channel) {
+ super(channel);
}
private TestServiceFutureStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- super(channel, config, callOptions);
+ super(channel, callOptions);
}
@java.lang.Override
protected TestServiceFutureStub build(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- return new TestServiceFutureStub(channel, config, callOptions);
+ return new TestServiceFutureStub(channel, callOptions);
}
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request) {
return futureUnaryCall(
- channel.newCall(config.unaryCall, callOptions), request);
+ channel.newCall(METHOD_UNARY_CALL, callOptions), request);
}
}
diff --git a/compiler/src/test/golden/TestServiceNano.java.txt b/compiler/src/test/golden/TestServiceNano.java.txt
index 9c6ea67..1b823ab 100644
--- a/compiler/src/test/golden/TestServiceNano.java.txt
+++ b/compiler/src/test/golden/TestServiceNano.java.txt
@@ -37,7 +37,6 @@
return io.grpc.testing.integration.Test.SimpleResponse.parseFrom(input);
}
}));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_STREAMING_OUTPUT_CALL =
io.grpc.MethodDescriptor.create(
@@ -57,7 +56,6 @@
return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
}
}));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_STREAMING_INPUT_CALL =
io.grpc.MethodDescriptor.create(
@@ -77,7 +75,6 @@
return io.grpc.testing.integration.Test.StreamingInputCallResponse.parseFrom(input);
}
}));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_FULL_DUPLEX_CALL =
io.grpc.MethodDescriptor.create(
@@ -97,7 +94,6 @@
return io.grpc.testing.integration.Test.StreamingOutputCallResponse.parseFrom(input);
}
}));
- // Static method descriptors that strictly reflect the proto.
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
io.grpc.testing.integration.Test.StreamingOutputCallResponse> METHOD_HALF_DUPLEX_CALL =
io.grpc.MethodDescriptor.create(
@@ -119,80 +115,17 @@
}));
public static TestServiceStub newStub(io.grpc.Channel channel) {
- return new TestServiceStub(channel, CONFIG);
+ return new TestServiceStub(channel);
}
public static TestServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
- return new TestServiceBlockingStub(channel, CONFIG);
+ return new TestServiceBlockingStub(channel);
}
public static TestServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
- return new TestServiceFutureStub(channel, CONFIG);
- }
-
- // The default service descriptor
- private static final TestServiceServiceDescriptor CONFIG =
- new TestServiceServiceDescriptor();
-
- @javax.annotation.concurrent.Immutable
- public static class TestServiceServiceDescriptor extends
- io.grpc.stub.AbstractServiceDescriptor<TestServiceServiceDescriptor> {
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
- io.grpc.testing.integration.Test.SimpleResponse> unaryCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.Test.StreamingInputCallResponse> streamingInputCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> fullDuplexCall;
- public final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse> halfDuplexCall;
-
- private TestServiceServiceDescriptor() {
- unaryCall = METHOD_UNARY_CALL;
- streamingOutputCall = METHOD_STREAMING_OUTPUT_CALL;
- streamingInputCall = METHOD_STREAMING_INPUT_CALL;
- fullDuplexCall = METHOD_FULL_DUPLEX_CALL;
- halfDuplexCall = METHOD_HALF_DUPLEX_CALL;
- }
-
- @SuppressWarnings("unchecked")
- private TestServiceServiceDescriptor(
- java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
- unaryCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
- io.grpc.testing.integration.Test.SimpleResponse>) methodMap.get(
- CONFIG.unaryCall.getFullMethodName());
- streamingOutputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
- CONFIG.streamingOutputCall.getFullMethodName());
- streamingInputCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.Test.StreamingInputCallResponse>) methodMap.get(
- CONFIG.streamingInputCall.getFullMethodName());
- fullDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
- CONFIG.fullDuplexCall.getFullMethodName());
- halfDuplexCall = (io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>) methodMap.get(
- CONFIG.halfDuplexCall.getFullMethodName());
- }
-
- @java.lang.Override
- protected TestServiceServiceDescriptor build(
- java.util.Map<java.lang.String, io.grpc.MethodDescriptor<?, ?>> methodMap) {
- return new TestServiceServiceDescriptor(methodMap);
- }
-
- @java.lang.Override
- public java.util.Collection<io.grpc.MethodDescriptor<?, ?>> methods() {
- return com.google.common.collect.ImmutableList.<io.grpc.MethodDescriptor<?, ?>>of(
- unaryCall,
- streamingOutputCall,
- streamingInputCall,
- fullDuplexCall,
- halfDuplexCall);
- }
+ return new TestServiceFutureStub(channel);
}
public static interface TestService {
@@ -227,124 +160,112 @@
io.grpc.testing.integration.Test.SimpleRequest request);
}
- public static class TestServiceStub extends
- io.grpc.stub.AbstractStub<TestServiceStub, TestServiceServiceDescriptor>
+ public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
implements TestService {
- private TestServiceStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config) {
- super(channel, config);
+ private TestServiceStub(io.grpc.Channel channel) {
+ super(channel);
}
private TestServiceStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- super(channel, config, callOptions);
+ super(channel, callOptions);
}
@java.lang.Override
protected TestServiceStub build(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- return new TestServiceStub(channel, config, callOptions);
+ return new TestServiceStub(channel, callOptions);
}
@java.lang.Override
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
asyncUnaryCall(
- channel.newCall(config.unaryCall, callOptions), request, responseObserver);
+ channel.newCall(METHOD_UNARY_CALL, callOptions), request, responseObserver);
}
@java.lang.Override
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
asyncServerStreamingCall(
- channel.newCall(config.streamingOutputCall, callOptions), request, responseObserver);
+ channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request, responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
return asyncClientStreamingCall(
- channel.newCall(config.streamingInputCall, callOptions), responseObserver);
+ channel.newCall(METHOD_STREAMING_INPUT_CALL, callOptions), responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncDuplexStreamingCall(
- channel.newCall(config.fullDuplexCall, callOptions), responseObserver);
+ channel.newCall(METHOD_FULL_DUPLEX_CALL, callOptions), responseObserver);
}
@java.lang.Override
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfDuplexCall(
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
return asyncDuplexStreamingCall(
- channel.newCall(config.halfDuplexCall, callOptions), responseObserver);
+ channel.newCall(METHOD_HALF_DUPLEX_CALL, callOptions), responseObserver);
}
}
- public static class TestServiceBlockingStub extends
- io.grpc.stub.AbstractStub<TestServiceBlockingStub, TestServiceServiceDescriptor>
+ public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
implements TestServiceBlockingClient {
- private TestServiceBlockingStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config) {
- super(channel, config);
+ private TestServiceBlockingStub(io.grpc.Channel channel) {
+ super(channel);
}
private TestServiceBlockingStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- super(channel, config, callOptions);
+ super(channel, callOptions);
}
@java.lang.Override
protected TestServiceBlockingStub build(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- return new TestServiceBlockingStub(channel, config, callOptions);
+ return new TestServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
return blockingUnaryCall(
- channel.newCall(config.unaryCall, callOptions), request);
+ channel.newCall(METHOD_UNARY_CALL, callOptions), request);
}
@java.lang.Override
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
return blockingServerStreamingCall(
- channel.newCall(config.streamingOutputCall, callOptions), request);
+ channel.newCall(METHOD_STREAMING_OUTPUT_CALL, callOptions), request);
}
}
- public static class TestServiceFutureStub extends
- io.grpc.stub.AbstractStub<TestServiceFutureStub, TestServiceServiceDescriptor>
+ public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
implements TestServiceFutureClient {
- private TestServiceFutureStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config) {
- super(channel, config);
+ private TestServiceFutureStub(io.grpc.Channel channel) {
+ super(channel);
}
private TestServiceFutureStub(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- super(channel, config, callOptions);
+ super(channel, callOptions);
}
@java.lang.Override
protected TestServiceFutureStub build(io.grpc.Channel channel,
- TestServiceServiceDescriptor config,
io.grpc.CallOptions callOptions) {
- return new TestServiceFutureStub(channel, config, callOptions);
+ return new TestServiceFutureStub(channel, callOptions);
}
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
io.grpc.testing.integration.Test.SimpleRequest request) {
return futureUnaryCall(
- channel.newCall(config.unaryCall, callOptions), request);
+ channel.newCall(METHOD_UNARY_CALL, callOptions), request);
}
}