Private ServerMethodDefinition constructor; avoid create() in codegen
There is no need to use ServerMethodDefinition in codegen. The create()
method itself could be helpful to a dynamic HandlerRegistry
implementation, so we won't remove it.
diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt
index 66021a7..e263f67 100644
--- a/compiler/src/test/golden/TestService.java.txt
+++ b/compiler/src/test/golden/TestService.java.txt
@@ -225,67 +225,67 @@
public static io.grpc.ServerServiceDefinition bindService(
final TestService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
- .addMethod(io.grpc.ServerMethodDefinition.create(
- METHOD_UNARY_CALL,
- asyncUnaryCall(
- new io.grpc.stub.ServerCalls.UnaryMethod<
- io.grpc.testing.integration.Test.SimpleRequest,
- io.grpc.testing.integration.Test.SimpleResponse>() {
- @java.lang.Override
- public void invoke(
- io.grpc.testing.integration.Test.SimpleRequest request,
- io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
- serviceImpl.unaryCall(request, responseObserver);
- }
- })))
- .addMethod(io.grpc.ServerMethodDefinition.create(
- METHOD_STREAMING_OUTPUT_CALL,
- asyncServerStreamingCall(
- new io.grpc.stub.ServerCalls.ServerStreamingMethod<
- io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
- @java.lang.Override
- public void invoke(
- io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
- io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
- serviceImpl.streamingOutputCall(request, responseObserver);
- }
- })))
- .addMethod(io.grpc.ServerMethodDefinition.create(
- METHOD_STREAMING_INPUT_CALL,
- asyncClientStreamingCall(
- new io.grpc.stub.ServerCalls.ClientStreamingMethod<
- io.grpc.testing.integration.Test.StreamingInputCallRequest,
- io.grpc.testing.integration.Test.StreamingInputCallResponse>() {
- @java.lang.Override
- public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> invoke(
- io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
- return serviceImpl.streamingInputCall(responseObserver);
- }
- })))
- .addMethod(io.grpc.ServerMethodDefinition.create(
- METHOD_FULL_BIDI_CALL,
- asyncBidiStreamingCall(
- new io.grpc.stub.ServerCalls.BidiStreamingMethod<
- io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
- @java.lang.Override
- public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
- io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
- return serviceImpl.fullBidiCall(responseObserver);
- }
- })))
- .addMethod(io.grpc.ServerMethodDefinition.create(
- METHOD_HALF_BIDI_CALL,
- asyncBidiStreamingCall(
- new io.grpc.stub.ServerCalls.BidiStreamingMethod<
- io.grpc.testing.integration.Test.StreamingOutputCallRequest,
- io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
- @java.lang.Override
- public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
- io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
- return serviceImpl.halfBidiCall(responseObserver);
- }
- }))).build();
+ .addMethod(
+ METHOD_UNARY_CALL,
+ asyncUnaryCall(
+ new io.grpc.stub.ServerCalls.UnaryMethod<
+ io.grpc.testing.integration.Test.SimpleRequest,
+ io.grpc.testing.integration.Test.SimpleResponse>() {
+ @java.lang.Override
+ public void invoke(
+ io.grpc.testing.integration.Test.SimpleRequest request,
+ io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
+ serviceImpl.unaryCall(request, responseObserver);
+ }
+ }))
+ .addMethod(
+ METHOD_STREAMING_OUTPUT_CALL,
+ asyncServerStreamingCall(
+ new io.grpc.stub.ServerCalls.ServerStreamingMethod<
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+ @java.lang.Override
+ public void invoke(
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
+ io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+ serviceImpl.streamingOutputCall(request, responseObserver);
+ }
+ }))
+ .addMethod(
+ METHOD_STREAMING_INPUT_CALL,
+ asyncClientStreamingCall(
+ new io.grpc.stub.ServerCalls.ClientStreamingMethod<
+ io.grpc.testing.integration.Test.StreamingInputCallRequest,
+ io.grpc.testing.integration.Test.StreamingInputCallResponse>() {
+ @java.lang.Override
+ public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> invoke(
+ io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
+ return serviceImpl.streamingInputCall(responseObserver);
+ }
+ }))
+ .addMethod(
+ METHOD_FULL_BIDI_CALL,
+ asyncBidiStreamingCall(
+ new io.grpc.stub.ServerCalls.BidiStreamingMethod<
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+ @java.lang.Override
+ public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
+ io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+ return serviceImpl.fullBidiCall(responseObserver);
+ }
+ }))
+ .addMethod(
+ METHOD_HALF_BIDI_CALL,
+ asyncBidiStreamingCall(
+ new io.grpc.stub.ServerCalls.BidiStreamingMethod<
+ io.grpc.testing.integration.Test.StreamingOutputCallRequest,
+ io.grpc.testing.integration.Test.StreamingOutputCallResponse>() {
+ @java.lang.Override
+ public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> invoke(
+ io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
+ return serviceImpl.halfBidiCall(responseObserver);
+ }
+ })).build();
}
}