Go to the documentation of this file.
60 name_resolver_(context->GetNameResolver()) {}
70 "public $static$ abstract class $classname$\n"
71 " implements com.google.protobuf.Service {\n",
72 "static", is_own_file ?
"" :
"static",
"classname",
descriptor_->
name());
75 printer->
Print(
"protected $classname$() {}\n\n",
"classname",
87 "public static final\n"
88 " com.google.protobuf.Descriptors.ServiceDescriptor\n"
89 " getDescriptor() {\n"
90 " return $file$.getDescriptor().getServices().get($index$);\n"
106 "// @@protoc_insertion_point(class_scope:$full_name$)\n",
110 printer->
Print(
"}\n\n");
116 "public final com.google.protobuf.Descriptors.ServiceDescriptor\n"
117 " getDescriptorForType() {\n"
118 " return getDescriptor();\n"
123 printer->
Print(
"public interface Interface {\n");
127 printer->
Print(
"}\n\n");
133 "public static com.google.protobuf.Service newReflectiveService(\n"
134 " final Interface impl) {\n"
135 " return new $classname$() {\n",
142 printer->
Print(
"@java.lang.Override\n");
146 " impl.$method$(controller, request, done);\n"
152 printer->
Print(
"};\n");
154 printer->
Print(
"}\n\n");
160 "public static com.google.protobuf.BlockingService\n"
161 " newReflectiveBlockingService(final BlockingInterface impl) {\n"
162 " return new com.google.protobuf.BlockingService() {\n");
173 printer->
Print(
"};\n");
175 printer->
Print(
"}\n\n");
183 printer->
Print(
";\n\n");
195 "public final void callMethod(\n"
196 " com.google.protobuf.Descriptors.MethodDescriptor method,\n"
197 " com.google.protobuf.RpcController controller,\n"
198 " com.google.protobuf.Message request,\n"
199 " com.google.protobuf.RpcCallback<\n"
200 " com.google.protobuf.Message> done) {\n"
201 " if (method.getService() != getDescriptor()) {\n"
202 " throw new java.lang.IllegalArgumentException(\n"
203 " \"Service.callMethod() given method descriptor for wrong \" +\n"
204 " \"service type.\");\n"
206 " switch(method.getIndex()) {\n");
212 std::map<std::string, std::string> vars;
220 " this.$method$(controller, ($input$)request,\n"
221 " com.google.protobuf.RpcUtil.<$output$>specializeCallback(\n"
228 " throw new java.lang.AssertionError(\"Can't get here.\");\n");
243 "public final com.google.protobuf.Message callBlockingMethod(\n"
244 " com.google.protobuf.Descriptors.MethodDescriptor method,\n"
245 " com.google.protobuf.RpcController controller,\n"
246 " com.google.protobuf.Message request)\n"
247 " throws com.google.protobuf.ServiceException {\n"
248 " if (method.getService() != getDescriptor()) {\n"
249 " throw new java.lang.IllegalArgumentException(\n"
250 " \"Service.callBlockingMethod() given method descriptor for \" +\n"
251 " \"wrong service type.\");\n"
253 " switch(method.getIndex()) {\n");
259 std::map<std::string, std::string> vars;
266 " return impl.$method$(controller, ($input$)request);\n");
271 " throw new java.lang.AssertionError(\"Can't get here.\");\n");
289 "public final com.google.protobuf.Message\n"
290 " get$request_or_response$Prototype(\n"
291 " com.google.protobuf.Descriptors.MethodDescriptor method) {\n"
292 " if (method.getService() != getDescriptor()) {\n"
293 " throw new java.lang.IllegalArgumentException(\n"
294 " \"Service.get$request_or_response$Prototype() given method \" +\n"
295 " \"descriptor for wrong service type.\");\n"
297 " switch(method.getIndex()) {\n",
298 "request_or_response", (
which ==
REQUEST) ?
"Request" :
"Response");
304 std::map<std::string, std::string> vars;
312 " return $type$.getDefaultInstance();\n");
317 " throw new java.lang.AssertionError(\"Can't get here.\");\n");
330 "public static Stub newStub(\n"
331 " com.google.protobuf.RpcChannel channel) {\n"
332 " return new Stub(channel);\n"
335 "public static final class Stub extends $classname$ implements Interface "
342 "private Stub(com.google.protobuf.RpcChannel channel) {\n"
343 " this.channel = channel;\n"
346 "private final com.google.protobuf.RpcChannel channel;\n"
348 "public com.google.protobuf.RpcChannel getChannel() {\n"
354 printer->
Print(
"\n");
356 printer->
Print(
" {\n");
359 std::map<std::string, std::string> vars;
363 "channel.callMethod(\n"
364 " getDescriptor().getMethods().get($index$),\n"
367 " $output$.getDefaultInstance(),\n"
368 " com.google.protobuf.RpcUtil.generalizeCallback(\n"
371 " $output$.getDefaultInstance()));\n");
374 printer->
Print(
"}\n");
385 "public static BlockingInterface newBlockingStub(\n"
386 " com.google.protobuf.BlockingRpcChannel channel) {\n"
387 " return new BlockingStub(channel);\n"
391 printer->
Print(
"public interface BlockingInterface {");
397 printer->
Print(
";\n");
406 "private static final class BlockingStub implements BlockingInterface "
411 "private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) {\n"
412 " this.channel = channel;\n"
415 "private final com.google.protobuf.BlockingRpcChannel channel;\n");
420 printer->
Print(
" {\n");
423 std::map<std::string, std::string> vars;
427 "return ($output$) channel.callBlockingMethod(\n"
428 " getDescriptor().getMethods().get($index$),\n"
431 " $output$.getDefaultInstance());\n");
440 printer->
Print(
"}\n");
446 std::map<std::string, std::string> vars;
450 vars[
"abstract"] = (is_abstract ==
IS_ABSTRACT) ?
"abstract" :
"";
452 "public $abstract$ void $name$(\n"
453 " com.google.protobuf.RpcController controller,\n"
454 " $input$ request,\n"
455 " com.google.protobuf.RpcCallback<$output$> done)");
460 std::map<std::string, std::string> vars;
466 "public $output$ $method$(\n"
467 " com.google.protobuf.RpcController controller,\n"
468 " $input$ request)\n"
469 " throws com.google.protobuf.ServiceException");
std::string UnderscoresToCamelCase(const std::string &input, bool cap_next_letter)
void Print(const std::map< std::string, std::string > &variables, const char *text)
MockGeneratorContext context_
void GenerateMethodSignature(io::Printer *printer, const MethodDescriptor *method, IsAbstract is_abstract)
void MaybePrintGeneratedAnnotation(Context *context, io::Printer *printer, Descriptor *descriptor, bool immutable, const std::string &suffix="")
std::string GetOutput(const MethodDescriptor *method)
string StrCat(const AlphaNum &a, const AlphaNum &b)
ClassNameResolver * name_resolver_
const std::string & full_name() const
ServiceGenerator(const ServiceDescriptor *descriptor)
GLsizei const GLchar *const * string
std::string GetImmutableClassName(const DescriptorType *descriptor)
const std::string & name() const
virtual ~ServiceGenerator()
void GenerateNewReflectiveBlockingServiceMethod(io::Printer *printer)
void GenerateGetPrototype(RequestOrResponse which, io::Printer *printer)
void GenerateCallBlockingMethod(io::Printer *printer)
const ServiceDescriptor * descriptor_
void GenerateInterface(io::Printer *printer)
void GenerateNewReflectiveServiceMethod(io::Printer *printer)
void GenerateBlockingMethodSignature(io::Printer *printer, const MethodDescriptor *method)
void GenerateBlockingStub(io::Printer *printer)
const FileDescriptor * file() const
void WriteServiceDocComment(io::Printer *printer, const ServiceDescriptor *service)
virtual void Generate(io::Printer *printer)
void GenerateCallMethod(io::Printer *printer)
ImmutableServiceGenerator(const ServiceDescriptor *descriptor, Context *context)
void WriteMethodDocComment(io::Printer *printer, const MethodDescriptor *method)
void GenerateGetDescriptorForType(io::Printer *printer)
const MethodDescriptor * method(int index) const
const Descriptor * descriptor_
void GenerateAbstractMethods(io::Printer *printer)
bool IsOwnFile(const Descriptor *descriptor, bool immutable)
virtual ~ImmutableServiceGenerator()
const Descriptor::ReservedRange const EnumValueDescriptor method
void GenerateStub(io::Printer *printer)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:55