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