1212import static io .grpc .stub .ServerCalls .asyncServerStreamingCall ;
1313import static io .grpc .stub .ServerCalls .asyncClientStreamingCall ;
1414import static io .grpc .stub .ServerCalls .asyncBidiStreamingCall ;
15+ import static io .grpc .stub .ServerCalls .asyncUnimplementedUnaryCall ;
16+ import static io .grpc .stub .ServerCalls .asyncUnimplementedStreamingCall ;
1517
16- @ javax .annotation .Generated ("by gRPC proto compiler" )
18+ /**
19+ * <pre>
20+ * The greeter service definition.
21+ * </pre>
22+ */
23+ @ javax .annotation .Generated (
24+ value = "by gRPC proto compiler (version 0.15.0)" ,
25+ comments = "Source: greeter.proto" )
1726public class GreeterGrpc {
1827
1928 private GreeterGrpc () {}
2029
2130 public static final String SERVICE_NAME = "Greeter" ;
2231
2332 // Static method descriptors that strictly reflect the proto.
24- @ io .grpc .ExperimentalApi
33+ @ io .grpc .ExperimentalApi ( "https://github.com/grpc/grpc-java/issues/1901" )
2534 public static final io .grpc .MethodDescriptor <io .grpc .examples .GreeterOuterClass .HelloRequest ,
2635 io .grpc .examples .GreeterOuterClass .HelloReply > METHOD_SAY_HELLO =
2736 io .grpc .MethodDescriptor .create (
@@ -31,33 +40,86 @@ private GreeterGrpc() {}
3140 io .grpc .protobuf .ProtoUtils .marshaller (io .grpc .examples .GreeterOuterClass .HelloRequest .getDefaultInstance ()),
3241 io .grpc .protobuf .ProtoUtils .marshaller (io .grpc .examples .GreeterOuterClass .HelloReply .getDefaultInstance ()));
3342
43+ /**
44+ * Creates a new async stub that supports all call types for the service
45+ */
3446 public static GreeterStub newStub (io .grpc .Channel channel ) {
3547 return new GreeterStub (channel );
3648 }
3749
50+ /**
51+ * Creates a new blocking-style stub that supports unary and streaming output calls on the service
52+ */
3853 public static GreeterBlockingStub newBlockingStub (
3954 io .grpc .Channel channel ) {
4055 return new GreeterBlockingStub (channel );
4156 }
4257
58+ /**
59+ * Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
60+ */
4361 public static GreeterFutureStub newFutureStub (
4462 io .grpc .Channel channel ) {
4563 return new GreeterFutureStub (channel );
4664 }
4765
48- public static interface Greeter {
66+ /**
67+ * <pre>
68+ * The greeter service definition.
69+ * </pre>
70+ */
71+ @ java .lang .Deprecated public static interface Greeter {
4972
73+ /**
74+ * <pre>
75+ * Sends a greeting
76+ * </pre>
77+ */
5078 public void sayHello (io .grpc .examples .GreeterOuterClass .HelloRequest request ,
5179 io .grpc .stub .StreamObserver <io .grpc .examples .GreeterOuterClass .HelloReply > responseObserver );
5280 }
5381
54- public static interface GreeterBlockingClient {
82+ @ io .grpc .ExperimentalApi ("https://github.com/grpc/grpc-java/issues/1469" )
83+ public static abstract class GreeterImplBase implements Greeter , io .grpc .BindableService {
5584
85+ @ java .lang .Override
86+ public void sayHello (io .grpc .examples .GreeterOuterClass .HelloRequest request ,
87+ io .grpc .stub .StreamObserver <io .grpc .examples .GreeterOuterClass .HelloReply > responseObserver ) {
88+ asyncUnimplementedUnaryCall (METHOD_SAY_HELLO , responseObserver );
89+ }
90+
91+ @ java .lang .Override public io .grpc .ServerServiceDefinition bindService () {
92+ return GreeterGrpc .bindService (this );
93+ }
94+ }
95+
96+ /**
97+ * <pre>
98+ * The greeter service definition.
99+ * </pre>
100+ */
101+ @ java .lang .Deprecated public static interface GreeterBlockingClient {
102+
103+ /**
104+ * <pre>
105+ * Sends a greeting
106+ * </pre>
107+ */
56108 public io .grpc .examples .GreeterOuterClass .HelloReply sayHello (io .grpc .examples .GreeterOuterClass .HelloRequest request );
57109 }
58110
59- public static interface GreeterFutureClient {
111+ /**
112+ * <pre>
113+ * The greeter service definition.
114+ * </pre>
115+ */
116+ @ java .lang .Deprecated public static interface GreeterFutureClient {
60117
118+ /**
119+ * <pre>
120+ * Sends a greeting
121+ * </pre>
122+ */
61123 public com .google .common .util .concurrent .ListenableFuture <io .grpc .examples .GreeterOuterClass .HelloReply > sayHello (
62124 io .grpc .examples .GreeterOuterClass .HelloRequest request );
63125 }
@@ -107,7 +169,7 @@ protected GreeterBlockingStub build(io.grpc.Channel channel,
107169 @ java .lang .Override
108170 public io .grpc .examples .GreeterOuterClass .HelloReply sayHello (io .grpc .examples .GreeterOuterClass .HelloRequest request ) {
109171 return blockingUnaryCall (
110- getChannel (). newCall ( METHOD_SAY_HELLO , getCallOptions () ), request );
172+ getChannel (), METHOD_SAY_HELLO , getCallOptions (), request );
111173 }
112174 }
113175
@@ -136,21 +198,62 @@ public com.google.common.util.concurrent.ListenableFuture<io.grpc.examples.Greet
136198 }
137199 }
138200
139- public static io .grpc .ServerServiceDefinition bindService (
201+ @ java .lang .Deprecated public static abstract class AbstractGreeter extends GreeterImplBase {}
202+
203+ private static final int METHODID_SAY_HELLO = 0 ;
204+
205+ private static class MethodHandlers <Req , Resp > implements
206+ io .grpc .stub .ServerCalls .UnaryMethod <Req , Resp >,
207+ io .grpc .stub .ServerCalls .ServerStreamingMethod <Req , Resp >,
208+ io .grpc .stub .ServerCalls .ClientStreamingMethod <Req , Resp >,
209+ io .grpc .stub .ServerCalls .BidiStreamingMethod <Req , Resp > {
210+ private final Greeter serviceImpl ;
211+ private final int methodId ;
212+
213+ public MethodHandlers (Greeter serviceImpl , int methodId ) {
214+ this .serviceImpl = serviceImpl ;
215+ this .methodId = methodId ;
216+ }
217+
218+ @ java .lang .Override
219+ @ java .lang .SuppressWarnings ("unchecked" )
220+ public void invoke (Req request , io .grpc .stub .StreamObserver <Resp > responseObserver ) {
221+ switch (methodId ) {
222+ case METHODID_SAY_HELLO :
223+ serviceImpl .sayHello ((io .grpc .examples .GreeterOuterClass .HelloRequest ) request ,
224+ (io .grpc .stub .StreamObserver <io .grpc .examples .GreeterOuterClass .HelloReply >) responseObserver );
225+ break ;
226+ default :
227+ throw new AssertionError ();
228+ }
229+ }
230+
231+ @ java .lang .Override
232+ @ java .lang .SuppressWarnings ("unchecked" )
233+ public io .grpc .stub .StreamObserver <Req > invoke (
234+ io .grpc .stub .StreamObserver <Resp > responseObserver ) {
235+ switch (methodId ) {
236+ default :
237+ throw new AssertionError ();
238+ }
239+ }
240+ }
241+
242+ public static io .grpc .ServiceDescriptor getServiceDescriptor () {
243+ return new io .grpc .ServiceDescriptor (SERVICE_NAME ,
244+ METHOD_SAY_HELLO );
245+ }
246+
247+ @ java .lang .Deprecated public static io .grpc .ServerServiceDefinition bindService (
140248 final Greeter serviceImpl ) {
141- return io .grpc .ServerServiceDefinition .builder (SERVICE_NAME )
142- .addMethod (
143- METHOD_SAY_HELLO ,
144- asyncUnaryCall (
145- new io . grpc . stub . ServerCalls . UnaryMethod <
249+ return io .grpc .ServerServiceDefinition .builder (getServiceDescriptor () )
250+ .addMethod (
251+ METHOD_SAY_HELLO ,
252+ asyncUnaryCall (
253+ new MethodHandlers <
146254 io .grpc .examples .GreeterOuterClass .HelloRequest ,
147- io .grpc .examples .GreeterOuterClass .HelloReply >() {
148- @ java .lang .Override
149- public void invoke (
150- io .grpc .examples .GreeterOuterClass .HelloRequest request ,
151- io .grpc .stub .StreamObserver <io .grpc .examples .GreeterOuterClass .HelloReply > responseObserver ) {
152- serviceImpl .sayHello (request , responseObserver );
153- }
154- })).build ();
255+ io .grpc .examples .GreeterOuterClass .HelloReply >(
256+ serviceImpl , METHODID_SAY_HELLO )))
257+ .build ();
155258 }
156259}
0 commit comments