diff options
Diffstat (limited to 'src/google/protobuf/compiler/java/java_service.cc')
-rw-r--r-- | src/google/protobuf/compiler/java/java_service.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/google/protobuf/compiler/java/java_service.cc b/src/google/protobuf/compiler/java/java_service.cc index 9f34f010..988e1942 100644 --- a/src/google/protobuf/compiler/java/java_service.cc +++ b/src/google/protobuf/compiler/java/java_service.cc @@ -184,6 +184,10 @@ void ImmutableServiceGenerator::GenerateAbstractMethods(io::Printer* printer) { } } +string ImmutableServiceGenerator::GetOutput(const MethodDescriptor* method) { + return name_resolver_->GetImmutableClassName(method->output_type()); +} + void ImmutableServiceGenerator::GenerateCallMethod(io::Printer* printer) { printer->Print( "\n" @@ -204,13 +208,12 @@ void ImmutableServiceGenerator::GenerateCallMethod(io::Printer* printer) { for (int i = 0; i < descriptor_->method_count(); i++) { const MethodDescriptor* method = descriptor_->method(i); - map<string, string> vars; + std::map<string, string> vars; vars["index"] = SimpleItoa(i); vars["method"] = UnderscoresToCamelCase(method); vars["input"] = name_resolver_->GetImmutableClassName( method->input_type()); - vars["output"] = name_resolver_->GetImmutableClassName( - method->output_type()); + vars["output"] = GetOutput(method); printer->Print(vars, "case $index$:\n" " this.$method$(controller, ($input$)request,\n" @@ -252,13 +255,12 @@ void ImmutableServiceGenerator::GenerateCallBlockingMethod( for (int i = 0; i < descriptor_->method_count(); i++) { const MethodDescriptor* method = descriptor_->method(i); - map<string, string> vars; + std::map<string, string> vars; vars["index"] = SimpleItoa(i); vars["method"] = UnderscoresToCamelCase(method); vars["input"] = name_resolver_->GetImmutableClassName( method->input_type()); - vars["output"] = name_resolver_->GetImmutableClassName( - method->output_type()); + vars["output"] = GetOutput(method); printer->Print(vars, "case $index$:\n" " return impl.$method$(controller, ($input$)request);\n"); @@ -299,7 +301,7 @@ void ImmutableServiceGenerator::GenerateGetPrototype(RequestOrResponse which, for (int i = 0; i < descriptor_->method_count(); i++) { const MethodDescriptor* method = descriptor_->method(i); - map<string, string> vars; + std::map<string, string> vars; vars["index"] = SimpleItoa(i); vars["type"] = name_resolver_->GetImmutableClassName( (which == REQUEST) ? method->input_type() : method->output_type()); @@ -351,10 +353,9 @@ void ImmutableServiceGenerator::GenerateStub(io::Printer* printer) { printer->Print(" {\n"); printer->Indent(); - map<string, string> vars; + std::map<string, string> vars; vars["index"] = SimpleItoa(i); - vars["output"] = name_resolver_->GetImmutableClassName( - method->output_type()); + vars["output"] = GetOutput(method); printer->Print(vars, "channel.callMethod(\n" " getDescriptor().getMethods().get($index$),\n" @@ -416,10 +417,9 @@ void ImmutableServiceGenerator::GenerateBlockingStub(io::Printer* printer) { printer->Print(" {\n"); printer->Indent(); - map<string, string> vars; + std::map<string, string> vars; vars["index"] = SimpleItoa(i); - vars["output"] = name_resolver_->GetImmutableClassName( - method->output_type()); + vars["output"] = GetOutput(method); printer->Print(vars, "return ($output$) channel.callBlockingMethod(\n" " getDescriptor().getMethods().get($index$),\n" @@ -440,10 +440,10 @@ void ImmutableServiceGenerator::GenerateBlockingStub(io::Printer* printer) { void ImmutableServiceGenerator::GenerateMethodSignature(io::Printer* printer, const MethodDescriptor* method, IsAbstract is_abstract) { - map<string, string> vars; + std::map<string, string> vars; vars["name"] = UnderscoresToCamelCase(method); vars["input"] = name_resolver_->GetImmutableClassName(method->input_type()); - vars["output"] = name_resolver_->GetImmutableClassName(method->output_type()); + vars["output"] = GetOutput(method); vars["abstract"] = (is_abstract == IS_ABSTRACT) ? "abstract" : ""; printer->Print(vars, "public $abstract$ void $name$(\n" @@ -455,10 +455,10 @@ void ImmutableServiceGenerator::GenerateMethodSignature(io::Printer* printer, void ImmutableServiceGenerator::GenerateBlockingMethodSignature( io::Printer* printer, const MethodDescriptor* method) { - map<string, string> vars; + std::map<string, string> vars; vars["method"] = UnderscoresToCamelCase(method); vars["input"] = name_resolver_->GetImmutableClassName(method->input_type()); - vars["output"] = name_resolver_->GetImmutableClassName(method->output_type()); + vars["output"] = GetOutput(method); printer->Print(vars, "\n" "public $output$ $method$(\n" |