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