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