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