• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package io.grpc.testing.protobuf;
2 
3 import static io.grpc.MethodDescriptor.generateFullMethodName;
4 
5 /**
6  * <pre>
7  * A simple service for test.
8  * </pre>
9  */
10 @javax.annotation.Generated(
11     value = "by gRPC proto compiler",
12     comments = "Source: io/grpc/testing/protobuf/simpleservice.proto")
13 @io.grpc.stub.annotations.GrpcGenerated
14 public final class SimpleServiceGrpc {
15 
SimpleServiceGrpc()16   private SimpleServiceGrpc() {}
17 
18   public static final String SERVICE_NAME = "grpc.testing.SimpleService";
19 
20   // Static method descriptors that strictly reflect the proto.
21   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
22       io.grpc.testing.protobuf.SimpleResponse> getUnaryRpcMethod;
23 
24   @io.grpc.stub.annotations.RpcMethod(
25       fullMethodName = SERVICE_NAME + '/' + "UnaryRpc",
26       requestType = io.grpc.testing.protobuf.SimpleRequest.class,
27       responseType = io.grpc.testing.protobuf.SimpleResponse.class,
28       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
29   public static io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
getUnaryRpcMethod()30       io.grpc.testing.protobuf.SimpleResponse> getUnaryRpcMethod() {
31     io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse> getUnaryRpcMethod;
32     if ((getUnaryRpcMethod = SimpleServiceGrpc.getUnaryRpcMethod) == null) {
33       synchronized (SimpleServiceGrpc.class) {
34         if ((getUnaryRpcMethod = SimpleServiceGrpc.getUnaryRpcMethod) == null) {
35           SimpleServiceGrpc.getUnaryRpcMethod = getUnaryRpcMethod =
36               io.grpc.MethodDescriptor.<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse>newBuilder()
37               .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
38               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UnaryRpc"))
39               .setSampledToLocalTracing(true)
40               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
41                   io.grpc.testing.protobuf.SimpleRequest.getDefaultInstance()))
42               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
43                   io.grpc.testing.protobuf.SimpleResponse.getDefaultInstance()))
44               .setSchemaDescriptor(new SimpleServiceMethodDescriptorSupplier("UnaryRpc"))
45               .build();
46         }
47       }
48     }
49     return getUnaryRpcMethod;
50   }
51 
52   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
53       io.grpc.testing.protobuf.SimpleResponse> getClientStreamingRpcMethod;
54 
55   @io.grpc.stub.annotations.RpcMethod(
56       fullMethodName = SERVICE_NAME + '/' + "ClientStreamingRpc",
57       requestType = io.grpc.testing.protobuf.SimpleRequest.class,
58       responseType = io.grpc.testing.protobuf.SimpleResponse.class,
59       methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
60   public static io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
getClientStreamingRpcMethod()61       io.grpc.testing.protobuf.SimpleResponse> getClientStreamingRpcMethod() {
62     io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse> getClientStreamingRpcMethod;
63     if ((getClientStreamingRpcMethod = SimpleServiceGrpc.getClientStreamingRpcMethod) == null) {
64       synchronized (SimpleServiceGrpc.class) {
65         if ((getClientStreamingRpcMethod = SimpleServiceGrpc.getClientStreamingRpcMethod) == null) {
66           SimpleServiceGrpc.getClientStreamingRpcMethod = getClientStreamingRpcMethod =
67               io.grpc.MethodDescriptor.<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse>newBuilder()
68               .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
69               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ClientStreamingRpc"))
70               .setSampledToLocalTracing(true)
71               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
72                   io.grpc.testing.protobuf.SimpleRequest.getDefaultInstance()))
73               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
74                   io.grpc.testing.protobuf.SimpleResponse.getDefaultInstance()))
75               .setSchemaDescriptor(new SimpleServiceMethodDescriptorSupplier("ClientStreamingRpc"))
76               .build();
77         }
78       }
79     }
80     return getClientStreamingRpcMethod;
81   }
82 
83   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
84       io.grpc.testing.protobuf.SimpleResponse> getServerStreamingRpcMethod;
85 
86   @io.grpc.stub.annotations.RpcMethod(
87       fullMethodName = SERVICE_NAME + '/' + "ServerStreamingRpc",
88       requestType = io.grpc.testing.protobuf.SimpleRequest.class,
89       responseType = io.grpc.testing.protobuf.SimpleResponse.class,
90       methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
91   public static io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
getServerStreamingRpcMethod()92       io.grpc.testing.protobuf.SimpleResponse> getServerStreamingRpcMethod() {
93     io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse> getServerStreamingRpcMethod;
94     if ((getServerStreamingRpcMethod = SimpleServiceGrpc.getServerStreamingRpcMethod) == null) {
95       synchronized (SimpleServiceGrpc.class) {
96         if ((getServerStreamingRpcMethod = SimpleServiceGrpc.getServerStreamingRpcMethod) == null) {
97           SimpleServiceGrpc.getServerStreamingRpcMethod = getServerStreamingRpcMethod =
98               io.grpc.MethodDescriptor.<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse>newBuilder()
99               .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
100               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ServerStreamingRpc"))
101               .setSampledToLocalTracing(true)
102               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
103                   io.grpc.testing.protobuf.SimpleRequest.getDefaultInstance()))
104               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
105                   io.grpc.testing.protobuf.SimpleResponse.getDefaultInstance()))
106               .setSchemaDescriptor(new SimpleServiceMethodDescriptorSupplier("ServerStreamingRpc"))
107               .build();
108         }
109       }
110     }
111     return getServerStreamingRpcMethod;
112   }
113 
114   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
115       io.grpc.testing.protobuf.SimpleResponse> getBidiStreamingRpcMethod;
116 
117   @io.grpc.stub.annotations.RpcMethod(
118       fullMethodName = SERVICE_NAME + '/' + "BidiStreamingRpc",
119       requestType = io.grpc.testing.protobuf.SimpleRequest.class,
120       responseType = io.grpc.testing.protobuf.SimpleResponse.class,
121       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
122   public static io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest,
getBidiStreamingRpcMethod()123       io.grpc.testing.protobuf.SimpleResponse> getBidiStreamingRpcMethod() {
124     io.grpc.MethodDescriptor<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse> getBidiStreamingRpcMethod;
125     if ((getBidiStreamingRpcMethod = SimpleServiceGrpc.getBidiStreamingRpcMethod) == null) {
126       synchronized (SimpleServiceGrpc.class) {
127         if ((getBidiStreamingRpcMethod = SimpleServiceGrpc.getBidiStreamingRpcMethod) == null) {
128           SimpleServiceGrpc.getBidiStreamingRpcMethod = getBidiStreamingRpcMethod =
129               io.grpc.MethodDescriptor.<io.grpc.testing.protobuf.SimpleRequest, io.grpc.testing.protobuf.SimpleResponse>newBuilder()
130               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
131               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "BidiStreamingRpc"))
132               .setSampledToLocalTracing(true)
133               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
134                   io.grpc.testing.protobuf.SimpleRequest.getDefaultInstance()))
135               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
136                   io.grpc.testing.protobuf.SimpleResponse.getDefaultInstance()))
137               .setSchemaDescriptor(new SimpleServiceMethodDescriptorSupplier("BidiStreamingRpc"))
138               .build();
139         }
140       }
141     }
142     return getBidiStreamingRpcMethod;
143   }
144 
145   /**
146    * Creates a new async stub that supports all call types for the service
147    */
newStub(io.grpc.Channel channel)148   public static SimpleServiceStub newStub(io.grpc.Channel channel) {
149     io.grpc.stub.AbstractStub.StubFactory<SimpleServiceStub> factory =
150       new io.grpc.stub.AbstractStub.StubFactory<SimpleServiceStub>() {
151         @java.lang.Override
152         public SimpleServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
153           return new SimpleServiceStub(channel, callOptions);
154         }
155       };
156     return SimpleServiceStub.newStub(factory, channel);
157   }
158 
159   /**
160    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
161    */
newBlockingStub( io.grpc.Channel channel)162   public static SimpleServiceBlockingStub newBlockingStub(
163       io.grpc.Channel channel) {
164     io.grpc.stub.AbstractStub.StubFactory<SimpleServiceBlockingStub> factory =
165       new io.grpc.stub.AbstractStub.StubFactory<SimpleServiceBlockingStub>() {
166         @java.lang.Override
167         public SimpleServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
168           return new SimpleServiceBlockingStub(channel, callOptions);
169         }
170       };
171     return SimpleServiceBlockingStub.newStub(factory, channel);
172   }
173 
174   /**
175    * Creates a new ListenableFuture-style stub that supports unary calls on the service
176    */
newFutureStub( io.grpc.Channel channel)177   public static SimpleServiceFutureStub newFutureStub(
178       io.grpc.Channel channel) {
179     io.grpc.stub.AbstractStub.StubFactory<SimpleServiceFutureStub> factory =
180       new io.grpc.stub.AbstractStub.StubFactory<SimpleServiceFutureStub>() {
181         @java.lang.Override
182         public SimpleServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
183           return new SimpleServiceFutureStub(channel, callOptions);
184         }
185       };
186     return SimpleServiceFutureStub.newStub(factory, channel);
187   }
188 
189   /**
190    * <pre>
191    * A simple service for test.
192    * </pre>
193    */
194   public interface AsyncService {
195 
196     /**
197      * <pre>
198      * Simple unary RPC.
199      * </pre>
200      */
unaryRpc(io.grpc.testing.protobuf.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)201     default void unaryRpc(io.grpc.testing.protobuf.SimpleRequest request,
202         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
203       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUnaryRpcMethod(), responseObserver);
204     }
205 
206     /**
207      * <pre>
208      * Simple client-to-server streaming RPC.
209      * </pre>
210      */
clientStreamingRpc( io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)211     default io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleRequest> clientStreamingRpc(
212         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
213       return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getClientStreamingRpcMethod(), responseObserver);
214     }
215 
216     /**
217      * <pre>
218      * Simple server-to-client streaming RPC.
219      * </pre>
220      */
serverStreamingRpc(io.grpc.testing.protobuf.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)221     default void serverStreamingRpc(io.grpc.testing.protobuf.SimpleRequest request,
222         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
223       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getServerStreamingRpcMethod(), responseObserver);
224     }
225 
226     /**
227      * <pre>
228      * Simple bidirectional streaming RPC.
229      * </pre>
230      */
bidiStreamingRpc( io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)231     default io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleRequest> bidiStreamingRpc(
232         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
233       return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getBidiStreamingRpcMethod(), responseObserver);
234     }
235   }
236 
237   /**
238    * Base class for the server implementation of the service SimpleService.
239    * <pre>
240    * A simple service for test.
241    * </pre>
242    */
243   public static abstract class SimpleServiceImplBase
244       implements io.grpc.BindableService, AsyncService {
245 
bindService()246     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
247       return SimpleServiceGrpc.bindService(this);
248     }
249   }
250 
251   /**
252    * A stub to allow clients to do asynchronous rpc calls to service SimpleService.
253    * <pre>
254    * A simple service for test.
255    * </pre>
256    */
257   public static final class SimpleServiceStub
258       extends io.grpc.stub.AbstractAsyncStub<SimpleServiceStub> {
SimpleServiceStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)259     private SimpleServiceStub(
260         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
261       super(channel, callOptions);
262     }
263 
264     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)265     protected SimpleServiceStub build(
266         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
267       return new SimpleServiceStub(channel, callOptions);
268     }
269 
270     /**
271      * <pre>
272      * Simple unary RPC.
273      * </pre>
274      */
unaryRpc(io.grpc.testing.protobuf.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)275     public void unaryRpc(io.grpc.testing.protobuf.SimpleRequest request,
276         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
277       io.grpc.stub.ClientCalls.asyncUnaryCall(
278           getChannel().newCall(getUnaryRpcMethod(), getCallOptions()), request, responseObserver);
279     }
280 
281     /**
282      * <pre>
283      * Simple client-to-server streaming RPC.
284      * </pre>
285      */
clientStreamingRpc( io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)286     public io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleRequest> clientStreamingRpc(
287         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
288       return io.grpc.stub.ClientCalls.asyncClientStreamingCall(
289           getChannel().newCall(getClientStreamingRpcMethod(), getCallOptions()), responseObserver);
290     }
291 
292     /**
293      * <pre>
294      * Simple server-to-client streaming RPC.
295      * </pre>
296      */
serverStreamingRpc(io.grpc.testing.protobuf.SimpleRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)297     public void serverStreamingRpc(io.grpc.testing.protobuf.SimpleRequest request,
298         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
299       io.grpc.stub.ClientCalls.asyncServerStreamingCall(
300           getChannel().newCall(getServerStreamingRpcMethod(), getCallOptions()), request, responseObserver);
301     }
302 
303     /**
304      * <pre>
305      * Simple bidirectional streaming RPC.
306      * </pre>
307      */
bidiStreamingRpc( io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver)308     public io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleRequest> bidiStreamingRpc(
309         io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse> responseObserver) {
310       return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
311           getChannel().newCall(getBidiStreamingRpcMethod(), getCallOptions()), responseObserver);
312     }
313   }
314 
315   /**
316    * A stub to allow clients to do synchronous rpc calls to service SimpleService.
317    * <pre>
318    * A simple service for test.
319    * </pre>
320    */
321   public static final class SimpleServiceBlockingStub
322       extends io.grpc.stub.AbstractBlockingStub<SimpleServiceBlockingStub> {
SimpleServiceBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)323     private SimpleServiceBlockingStub(
324         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
325       super(channel, callOptions);
326     }
327 
328     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)329     protected SimpleServiceBlockingStub build(
330         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
331       return new SimpleServiceBlockingStub(channel, callOptions);
332     }
333 
334     /**
335      * <pre>
336      * Simple unary RPC.
337      * </pre>
338      */
unaryRpc(io.grpc.testing.protobuf.SimpleRequest request)339     public io.grpc.testing.protobuf.SimpleResponse unaryRpc(io.grpc.testing.protobuf.SimpleRequest request) {
340       return io.grpc.stub.ClientCalls.blockingUnaryCall(
341           getChannel(), getUnaryRpcMethod(), getCallOptions(), request);
342     }
343 
344     /**
345      * <pre>
346      * Simple server-to-client streaming RPC.
347      * </pre>
348      */
serverStreamingRpc( io.grpc.testing.protobuf.SimpleRequest request)349     public java.util.Iterator<io.grpc.testing.protobuf.SimpleResponse> serverStreamingRpc(
350         io.grpc.testing.protobuf.SimpleRequest request) {
351       return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
352           getChannel(), getServerStreamingRpcMethod(), getCallOptions(), request);
353     }
354   }
355 
356   /**
357    * A stub to allow clients to do ListenableFuture-style rpc calls to service SimpleService.
358    * <pre>
359    * A simple service for test.
360    * </pre>
361    */
362   public static final class SimpleServiceFutureStub
363       extends io.grpc.stub.AbstractFutureStub<SimpleServiceFutureStub> {
SimpleServiceFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)364     private SimpleServiceFutureStub(
365         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
366       super(channel, callOptions);
367     }
368 
369     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)370     protected SimpleServiceFutureStub build(
371         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
372       return new SimpleServiceFutureStub(channel, callOptions);
373     }
374 
375     /**
376      * <pre>
377      * Simple unary RPC.
378      * </pre>
379      */
unaryRpc( io.grpc.testing.protobuf.SimpleRequest request)380     public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.protobuf.SimpleResponse> unaryRpc(
381         io.grpc.testing.protobuf.SimpleRequest request) {
382       return io.grpc.stub.ClientCalls.futureUnaryCall(
383           getChannel().newCall(getUnaryRpcMethod(), getCallOptions()), request);
384     }
385   }
386 
387   private static final int METHODID_UNARY_RPC = 0;
388   private static final int METHODID_SERVER_STREAMING_RPC = 1;
389   private static final int METHODID_CLIENT_STREAMING_RPC = 2;
390   private static final int METHODID_BIDI_STREAMING_RPC = 3;
391 
392   private static final class MethodHandlers<Req, Resp> implements
393       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
394       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
395       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
396       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
397     private final AsyncService serviceImpl;
398     private final int methodId;
399 
MethodHandlers(AsyncService serviceImpl, int methodId)400     MethodHandlers(AsyncService serviceImpl, int methodId) {
401       this.serviceImpl = serviceImpl;
402       this.methodId = methodId;
403     }
404 
405     @java.lang.Override
406     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)407     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
408       switch (methodId) {
409         case METHODID_UNARY_RPC:
410           serviceImpl.unaryRpc((io.grpc.testing.protobuf.SimpleRequest) request,
411               (io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse>) responseObserver);
412           break;
413         case METHODID_SERVER_STREAMING_RPC:
414           serviceImpl.serverStreamingRpc((io.grpc.testing.protobuf.SimpleRequest) request,
415               (io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse>) responseObserver);
416           break;
417         default:
418           throw new AssertionError();
419       }
420     }
421 
422     @java.lang.Override
423     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)424     public io.grpc.stub.StreamObserver<Req> invoke(
425         io.grpc.stub.StreamObserver<Resp> responseObserver) {
426       switch (methodId) {
427         case METHODID_CLIENT_STREAMING_RPC:
428           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.clientStreamingRpc(
429               (io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse>) responseObserver);
430         case METHODID_BIDI_STREAMING_RPC:
431           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.bidiStreamingRpc(
432               (io.grpc.stub.StreamObserver<io.grpc.testing.protobuf.SimpleResponse>) responseObserver);
433         default:
434           throw new AssertionError();
435       }
436     }
437   }
438 
bindService(AsyncService service)439   public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
440     return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
441         .addMethod(
442           getUnaryRpcMethod(),
443           io.grpc.stub.ServerCalls.asyncUnaryCall(
444             new MethodHandlers<
445               io.grpc.testing.protobuf.SimpleRequest,
446               io.grpc.testing.protobuf.SimpleResponse>(
447                 service, METHODID_UNARY_RPC)))
448         .addMethod(
449           getClientStreamingRpcMethod(),
450           io.grpc.stub.ServerCalls.asyncClientStreamingCall(
451             new MethodHandlers<
452               io.grpc.testing.protobuf.SimpleRequest,
453               io.grpc.testing.protobuf.SimpleResponse>(
454                 service, METHODID_CLIENT_STREAMING_RPC)))
455         .addMethod(
456           getServerStreamingRpcMethod(),
457           io.grpc.stub.ServerCalls.asyncServerStreamingCall(
458             new MethodHandlers<
459               io.grpc.testing.protobuf.SimpleRequest,
460               io.grpc.testing.protobuf.SimpleResponse>(
461                 service, METHODID_SERVER_STREAMING_RPC)))
462         .addMethod(
463           getBidiStreamingRpcMethod(),
464           io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
465             new MethodHandlers<
466               io.grpc.testing.protobuf.SimpleRequest,
467               io.grpc.testing.protobuf.SimpleResponse>(
468                 service, METHODID_BIDI_STREAMING_RPC)))
469         .build();
470   }
471 
472   private static abstract class SimpleServiceBaseDescriptorSupplier
473       implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
SimpleServiceBaseDescriptorSupplier()474     SimpleServiceBaseDescriptorSupplier() {}
475 
476     @java.lang.Override
getFileDescriptor()477     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
478       return io.grpc.testing.protobuf.SimpleServiceProto.getDescriptor();
479     }
480 
481     @java.lang.Override
getServiceDescriptor()482     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
483       return getFileDescriptor().findServiceByName("SimpleService");
484     }
485   }
486 
487   private static final class SimpleServiceFileDescriptorSupplier
488       extends SimpleServiceBaseDescriptorSupplier {
SimpleServiceFileDescriptorSupplier()489     SimpleServiceFileDescriptorSupplier() {}
490   }
491 
492   private static final class SimpleServiceMethodDescriptorSupplier
493       extends SimpleServiceBaseDescriptorSupplier
494       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
495     private final String methodName;
496 
SimpleServiceMethodDescriptorSupplier(String methodName)497     SimpleServiceMethodDescriptorSupplier(String methodName) {
498       this.methodName = methodName;
499     }
500 
501     @java.lang.Override
getMethodDescriptor()502     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
503       return getServiceDescriptor().findMethodByName(methodName);
504     }
505   }
506 
507   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
508 
getServiceDescriptor()509   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
510     io.grpc.ServiceDescriptor result = serviceDescriptor;
511     if (result == null) {
512       synchronized (SimpleServiceGrpc.class) {
513         result = serviceDescriptor;
514         if (result == null) {
515           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
516               .setSchemaDescriptor(new SimpleServiceFileDescriptorSupplier())
517               .addMethod(getUnaryRpcMethod())
518               .addMethod(getClientStreamingRpcMethod())
519               .addMethod(getServerStreamingRpcMethod())
520               .addMethod(getBidiStreamingRpcMethod())
521               .build();
522         }
523       }
524     }
525     return result;
526   }
527 }
528