Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix REST transport client creation generated javadoc sample #1077

Merged
merged 1 commit into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected List<CommentStatement> createClassHeaderComments(
ServiceClientHeaderSampleComposer.composeSetEndpointSample(clientType, settingsType);
Sample transportSampleCode =
ServiceClientHeaderSampleComposer.composeTransportSample(
clientType, settingsType, "defaultHttpJsonTransportProviderBuilder");
clientType, settingsType, "newHttpJsonBuilder");
samples.addAll(
Arrays.asList(
classMethodSampleCode, credentialsSampleCode, endpointSampleCode, transportSampleCode));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public static Sample composeSetEndpointSample(TypeNode clientType, TypeNode sett
}

public static Sample composeTransportSample(
TypeNode clientType, TypeNode settingsType, String transportProviderMethod) {
TypeNode clientType, TypeNode settingsType, String transportBuilderMethod) {
String settingsName = JavaStyle.toLowerCamelCase(settingsType.reference().name());
String clientName = JavaStyle.toLowerCamelCase(clientType.reference().name());
VariableExpr settingsVarExpr =
Expand All @@ -294,26 +294,11 @@ public static Sample composeTransportSample(
MethodInvocationExpr newBuilderMethodExpr =
MethodInvocationExpr.builder()
.setStaticReferenceType(settingsType)
.setMethodName("newBuilder")
.build();
MethodInvocationExpr transportChannelProviderArg =
MethodInvocationExpr.builder()
.setExprReferenceExpr(
MethodInvocationExpr.builder()
.setStaticReferenceType(settingsType)
.setMethodName(transportProviderMethod)
.build())
.setMethodName("build")
.build();
MethodInvocationExpr credentialsMethodExpr =
MethodInvocationExpr.builder()
.setExprReferenceExpr(newBuilderMethodExpr)
.setArguments(transportChannelProviderArg)
.setMethodName("setTransportChannelProvider")
.setMethodName(transportBuilderMethod)
.build();
MethodInvocationExpr buildMethodExpr =
MethodInvocationExpr.builder()
.setExprReferenceExpr(credentialsMethodExpr)
.setExprReferenceExpr(newBuilderMethodExpr)
.setReturnType(settingsType)
.setMethodName("build")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ import javax.annotation.Generated;
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* EchoSettings echoSettings =
* EchoSettings.newBuilder()
* .setTransportChannelProvider(
* EchoSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* EchoSettings echoSettings = EchoSettings.newHttpJsonBuilder().build();
* EchoClient echoClient = EchoClient.create(echoSettings);
* }</pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@ import javax.annotation.Generated;
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* EchoEmpySettings echoEmpySettings =
* EchoEmpySettings.newBuilder()
* .setTransportChannelProvider(
* EchoEmpySettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* EchoEmpySettings echoEmpySettings = EchoEmpySettings.newHttpJsonBuilder().build();
* EchoEmpyClient echoEmpyClient = EchoEmpyClient.create(echoEmpySettings);
* }</pre>
*
Expand Down