Home | History | Annotate | Download | only in golden
      1 package io.grpc.testing.compiler.nano;
      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 import java.io.IOException;
     19 
     20 /**
     21  * <pre>
     22  * Test service that has been deprecated and should generate with Java's &#64;Deprecated annotation
     23  * </pre>
     24  */
     25 @javax.annotation.Generated(
     26     value = "by gRPC proto compiler (version 1.16.0-SNAPSHOT)",
     27     comments = "Source: grpc/testing/compiler/test.proto")
     28 @java.lang.Deprecated
     29 public final class TestDeprecatedServiceGrpc {
     30 
     31   private TestDeprecatedServiceGrpc() {}
     32 
     33   public static final String SERVICE_NAME = "grpc.testing.compiler.TestDeprecatedService";
     34 
     35   // Static method descriptors that strictly reflect the proto.
     36   private static final int ARG_IN_METHOD_DEPRECATED_METHOD = 0;
     37   private static final int ARG_OUT_METHOD_DEPRECATED_METHOD = 1;
     38   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.SimpleRequest,
     39       io.grpc.testing.compiler.nano.Test.SimpleResponse> getDeprecatedMethodMethod;
     40 
     41   public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.SimpleRequest,
     42       io.grpc.testing.compiler.nano.Test.SimpleResponse> getDeprecatedMethodMethod() {
     43     io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.SimpleRequest, io.grpc.testing.compiler.nano.Test.SimpleResponse> getDeprecatedMethodMethod;
     44     if ((getDeprecatedMethodMethod = TestDeprecatedServiceGrpc.getDeprecatedMethodMethod) == null) {
     45       synchronized (TestDeprecatedServiceGrpc.class) {
     46         if ((getDeprecatedMethodMethod = TestDeprecatedServiceGrpc.getDeprecatedMethodMethod) == null) {
     47           TestDeprecatedServiceGrpc.getDeprecatedMethodMethod = getDeprecatedMethodMethod = 
     48               io.grpc.MethodDescriptor.<io.grpc.testing.compiler.nano.Test.SimpleRequest, io.grpc.testing.compiler.nano.Test.SimpleResponse>newBuilder()
     49               .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
     50               .setFullMethodName(generateFullMethodName(
     51                   "grpc.testing.compiler.TestDeprecatedService", "DeprecatedMethod"))
     52               .setSampledToLocalTracing(true)
     53               .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.SimpleRequest>marshaller(
     54                   new NanoFactory<io.grpc.testing.compiler.nano.Test.SimpleRequest>(ARG_IN_METHOD_DEPRECATED_METHOD)))
     55               .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.SimpleResponse>marshaller(
     56                   new NanoFactory<io.grpc.testing.compiler.nano.Test.SimpleResponse>(ARG_OUT_METHOD_DEPRECATED_METHOD)))
     57               .build();
     58         }
     59       }
     60     }
     61     return getDeprecatedMethodMethod;
     62   }
     63 
     64   private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
     65       implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
     66     private final int id;
     67 
     68     NanoFactory(int id) {
     69       this.id = id;
     70     }
     71 
     72     @java.lang.Override
     73     public T newInstance() {
     74       Object o;
     75       switch (id) {
     76       case ARG_IN_METHOD_DEPRECATED_METHOD:
     77         o = new io.grpc.testing.compiler.nano.Test.SimpleRequest();
     78         break;
     79       case ARG_OUT_METHOD_DEPRECATED_METHOD:
     80         o = new io.grpc.testing.compiler.nano.Test.SimpleResponse();
     81         break;
     82       default:
     83         throw new AssertionError();
     84       }
     85       @java.lang.SuppressWarnings("unchecked")
     86       T t = (T) o;
     87       return t;
     88     }
     89   }
     90 
     91   /**
     92    * Creates a new async stub that supports all call types for the service
     93    */
     94   public static TestDeprecatedServiceStub newStub(io.grpc.Channel channel) {
     95     return new TestDeprecatedServiceStub(channel);
     96   }
     97 
     98   /**
     99    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
    100    */
    101   public static TestDeprecatedServiceBlockingStub newBlockingStub(
    102       io.grpc.Channel channel) {
    103     return new TestDeprecatedServiceBlockingStub(channel);
    104   }
    105 
    106   /**
    107    * Creates a new ListenableFuture-style stub that supports unary calls on the service
    108    */
    109   public static TestDeprecatedServiceFutureStub newFutureStub(
    110       io.grpc.Channel channel) {
    111     return new TestDeprecatedServiceFutureStub(channel);
    112   }
    113 
    114   /**
    115    * <pre>
    116    * Test service that has been deprecated and should generate with Java's &#64;Deprecated annotation
    117    * </pre>
    118    */
    119   @java.lang.Deprecated
    120   public static abstract class TestDeprecatedServiceImplBase implements io.grpc.BindableService {
    121 
    122     /**
    123      * <pre>
    124      * An RPC method that has been deprecated and should generate with Java's &#64;Deprecated annotation
    125      * </pre>
    126      */
    127     @java.lang.Deprecated
    128     public void deprecatedMethod(io.grpc.testing.compiler.nano.Test.SimpleRequest request,
    129         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.SimpleResponse> responseObserver) {
    130       asyncUnimplementedUnaryCall(getDeprecatedMethodMethod(), responseObserver);
    131     }
    132 
    133     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
    134       return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
    135           .addMethod(
    136             getDeprecatedMethodMethod(),
    137             asyncUnaryCall(
    138               new MethodHandlers<
    139                 io.grpc.testing.compiler.nano.Test.SimpleRequest,
    140                 io.grpc.testing.compiler.nano.Test.SimpleResponse>(
    141                   this, METHODID_DEPRECATED_METHOD)))
    142           .build();
    143     }
    144   }
    145 
    146   /**
    147    * <pre>
    148    * Test service that has been deprecated and should generate with Java's &#64;Deprecated annotation
    149    * </pre>
    150    */
    151   @java.lang.Deprecated
    152   public static final class TestDeprecatedServiceStub extends io.grpc.stub.AbstractStub<TestDeprecatedServiceStub> {
    153     private TestDeprecatedServiceStub(io.grpc.Channel channel) {
    154       super(channel);
    155     }
    156 
    157     private TestDeprecatedServiceStub(io.grpc.Channel channel,
    158         io.grpc.CallOptions callOptions) {
    159       super(channel, callOptions);
    160     }
    161 
    162     @java.lang.Override
    163     protected TestDeprecatedServiceStub build(io.grpc.Channel channel,
    164         io.grpc.CallOptions callOptions) {
    165       return new TestDeprecatedServiceStub(channel, callOptions);
    166     }
    167 
    168     /**
    169      * <pre>
    170      * An RPC method that has been deprecated and should generate with Java's &#64;Deprecated annotation
    171      * </pre>
    172      */
    173     @java.lang.Deprecated
    174     public void deprecatedMethod(io.grpc.testing.compiler.nano.Test.SimpleRequest request,
    175         io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.SimpleResponse> responseObserver) {
    176       asyncUnaryCall(
    177           getChannel().newCall(getDeprecatedMethodMethod(), getCallOptions()), request, responseObserver);
    178     }
    179   }
    180 
    181   /**
    182    * <pre>
    183    * Test service that has been deprecated and should generate with Java's &#64;Deprecated annotation
    184    * </pre>
    185    */
    186   @java.lang.Deprecated
    187   public static final class TestDeprecatedServiceBlockingStub extends io.grpc.stub.AbstractStub<TestDeprecatedServiceBlockingStub> {
    188     private TestDeprecatedServiceBlockingStub(io.grpc.Channel channel) {
    189       super(channel);
    190     }
    191 
    192     private TestDeprecatedServiceBlockingStub(io.grpc.Channel channel,
    193         io.grpc.CallOptions callOptions) {
    194       super(channel, callOptions);
    195     }
    196 
    197     @java.lang.Override
    198     protected TestDeprecatedServiceBlockingStub build(io.grpc.Channel channel,
    199         io.grpc.CallOptions callOptions) {
    200       return new TestDeprecatedServiceBlockingStub(channel, callOptions);
    201     }
    202 
    203     /**
    204      * <pre>
    205      * An RPC method that has been deprecated and should generate with Java's &#64;Deprecated annotation
    206      * </pre>
    207      */
    208     @java.lang.Deprecated
    209     public io.grpc.testing.compiler.nano.Test.SimpleResponse deprecatedMethod(io.grpc.testing.compiler.nano.Test.SimpleRequest request) {
    210       return blockingUnaryCall(
    211           getChannel(), getDeprecatedMethodMethod(), getCallOptions(), request);
    212     }
    213   }
    214 
    215   /**
    216    * <pre>
    217    * Test service that has been deprecated and should generate with Java's &#64;Deprecated annotation
    218    * </pre>
    219    */
    220   @java.lang.Deprecated
    221   public static final class TestDeprecatedServiceFutureStub extends io.grpc.stub.AbstractStub<TestDeprecatedServiceFutureStub> {
    222     private TestDeprecatedServiceFutureStub(io.grpc.Channel channel) {
    223       super(channel);
    224     }
    225 
    226     private TestDeprecatedServiceFutureStub(io.grpc.Channel channel,
    227         io.grpc.CallOptions callOptions) {
    228       super(channel, callOptions);
    229     }
    230 
    231     @java.lang.Override
    232     protected TestDeprecatedServiceFutureStub build(io.grpc.Channel channel,
    233         io.grpc.CallOptions callOptions) {
    234       return new TestDeprecatedServiceFutureStub(channel, callOptions);
    235     }
    236 
    237     /**
    238      * <pre>
    239      * An RPC method that has been deprecated and should generate with Java's &#64;Deprecated annotation
    240      * </pre>
    241      */
    242     @java.lang.Deprecated
    243     public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.compiler.nano.Test.SimpleResponse> deprecatedMethod(
    244         io.grpc.testing.compiler.nano.Test.SimpleRequest request) {
    245       return futureUnaryCall(
    246           getChannel().newCall(getDeprecatedMethodMethod(), getCallOptions()), request);
    247     }
    248   }
    249 
    250   private static final int METHODID_DEPRECATED_METHOD = 0;
    251 
    252   private static final class MethodHandlers<Req, Resp> implements
    253       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
    254       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
    255       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
    256       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    257     private final TestDeprecatedServiceImplBase serviceImpl;
    258     private final int methodId;
    259 
    260     MethodHandlers(TestDeprecatedServiceImplBase serviceImpl, int methodId) {
    261       this.serviceImpl = serviceImpl;
    262       this.methodId = methodId;
    263     }
    264 
    265     @java.lang.Override
    266     @java.lang.SuppressWarnings("unchecked")
    267     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
    268       switch (methodId) {
    269         case METHODID_DEPRECATED_METHOD:
    270           serviceImpl.deprecatedMethod((io.grpc.testing.compiler.nano.Test.SimpleRequest) request,
    271               (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.SimpleResponse>) responseObserver);
    272           break;
    273         default:
    274           throw new AssertionError();
    275       }
    276     }
    277 
    278     @java.lang.Override
    279     @java.lang.SuppressWarnings("unchecked")
    280     public io.grpc.stub.StreamObserver<Req> invoke(
    281         io.grpc.stub.StreamObserver<Resp> responseObserver) {
    282       switch (methodId) {
    283         default:
    284           throw new AssertionError();
    285       }
    286     }
    287   }
    288 
    289   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
    290 
    291   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    292     io.grpc.ServiceDescriptor result = serviceDescriptor;
    293     if (result == null) {
    294       synchronized (TestDeprecatedServiceGrpc.class) {
    295         result = serviceDescriptor;
    296         if (result == null) {
    297           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
    298               .addMethod(getDeprecatedMethodMethod())
    299               .build();
    300         }
    301       }
    302     }
    303     return result;
    304   }
    305 }
    306