File tree Expand file tree Collapse file tree
main/java/com/google/api/generator/gapic/composer
test/java/com/google/api/generator/gapic/composer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- package (default_visibility = ["//visibility:public" ])
2-
31load (
42 "//:gapic_generator_java.bzl" ,
53 "google_java_format" ,
64 "google_java_format_verification" ,
75)
86
7+ package (default_visibility = ["//visibility:public" ])
8+
99JAVA_SRCS = [
1010 "//src/main/java/com/google/api/generator:generator_files" ,
1111 "//src/main/java/com/google/api/generator/engine:engine_files" ,
Original file line number Diff line number Diff line change @@ -464,7 +464,10 @@ private static List<MethodDefinition> createMethodVariants(
464464 List <MethodDefinition > javaMethods = new ArrayList <>();
465465 String methodName = JavaStyle .toLowerCamelCase (method .name ());
466466 TypeNode methodInputType = method .inputType ();
467- TypeNode methodOutputType = method .outputType ();
467+ TypeNode methodOutputType =
468+ method .isPaged ()
469+ ? types .get (String .format (PAGED_RESPONSE_TYPE_NAME_PATTERN , method .name ()))
470+ : method .outputType ();
468471 String methodInputTypeName = methodInputType .reference ().name ();
469472
470473 Message inputMessage = messageTypes .get (methodInputTypeName );
@@ -579,11 +582,12 @@ private static List<MethodDefinition> createMethodVariants(
579582 .setVariable (Variable .builder ().setName ("request" ).setType (methodInputType ).build ())
580583 .setIsDecl (true )
581584 .build ();
582-
585+ String callableMethodName =
586+ method .isPaged ()
587+ ? String .format (PAGED_CALLABLE_NAME_PATTERN , methodName )
588+ : String .format (CALLABLE_NAME_PATTERN , methodName );
583589 MethodInvocationExpr methodReturnExpr =
584- MethodInvocationExpr .builder ()
585- .setMethodName (String .format (CALLABLE_NAME_PATTERN , methodName ))
586- .build ();
590+ MethodInvocationExpr .builder ().setMethodName (callableMethodName ).build ();
587591 methodReturnExpr =
588592 MethodInvocationExpr .builder ()
589593 .setMethodName ("call" )
Original file line number Diff line number Diff line change @@ -223,17 +223,16 @@ public void generateServiceClasses() {
223223 + " return stub.chatAgainCallable();\n "
224224 + " }\n "
225225 + "\n "
226- + " public final PagedExpandResponse pagedExpand(PagedExpandRequest request) {\n "
227- + " return pagedExpandCallable ().call(request);\n "
226+ + " public final PagedExpandPagedResponse pagedExpand(PagedExpandRequest request) {\n "
227+ + " return pagedExpandPagedCallable ().call(request);\n "
228228 + " }\n "
229229 + "\n "
230230 + " public final UnaryCallable<PagedExpandRequest, PagedExpandPagedResponse>\n "
231231 + " pagedExpandPagedCallable() {\n "
232232 + " return stub.pagedExpandPagedCallable();\n "
233233 + " }\n "
234234 + "\n "
235- + " public final UnaryCallable<PagedExpandRequest, PagedExpandResponse>"
236- + " pagedExpandCallable() {\n "
235+ + " public final UnaryCallable<PagedExpandRequest, PagedExpandResponse> pagedExpandCallable() {\n "
237236 + " return stub.pagedExpandCallable();\n "
238237 + " }\n "
239238 + "\n "
You can’t perform that action at this time.
0 commit comments