Skip to content
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 @@ -78,6 +78,10 @@ public class SettingsCommentComposer {
public static final CommentStatement DEFAULT_CREDENTIALS_PROVIDER_BUILDER_METHOD_COMMENT =
toCommentStatement("Returns a builder for the default credentials for this service.");

public static final CommentStatement SET_HTTP_JSON_INTERNAL_HEADER_PROVIDER_METHOD_COMMENT =
toCommentStatement(
"Sets the internal HeaderProvider for HTTP/JSON. Does not change the transport.");

public static final CommentStatement DEFAULT_TRANSPORT_PROVIDER_BUILDER_METHOD_COMMENT =
toCommentStatement("Returns a builder for the default ChannelProvider for this service.");

Expand Down Expand Up @@ -130,6 +134,11 @@ public static CommentStatement createCallSettingsGetterComment(
isMethodInternal);
}

public static CommentStatement createResumableUploadCallSettingsGetterComment(
String javaMethodName, boolean isMethodDeprecated, boolean isMethodInternal) {
return createCallSettingsGetterComment(javaMethodName, isMethodDeprecated, isMethodInternal);
}

public static CommentStatement createBuilderClassComment(String outerClassName) {
return toCommentStatement(String.format(BUILDER_CLASS_DOC_PATTERN, outerClassName));
}
Expand All @@ -140,6 +149,12 @@ public static CommentStatement createCallSettingsBuilderGetterComment(
return toCommentStatement(methodComment, isMethodDeprecated, isMethodInternal);
}

public static CommentStatement createResumableUploadCallSettingsBuilderGetterComment(
String javaMethodName, boolean isMethodDeprecated, boolean isMethodInternal) {
return createCallSettingsBuilderGetterComment(
javaMethodName, isMethodDeprecated, isMethodInternal);
}

public static List<CommentStatement> createClassHeaderComments(
String configuredClassName,
String defaultHost,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.ResumableUploadCallSettings;
import com.google.api.gax.rpc.ServerStreamingCallSettings;
import com.google.api.gax.rpc.StreamingCallSettings;
import com.google.api.gax.rpc.StubSettings;
Expand Down Expand Up @@ -153,7 +154,7 @@ private static List<CommentStatement> createClassHeaderComments(
// list.
List<Method> publicMethods =
service.methods().stream()
.filter(m -> m.isInternalApi() == false)
.filter(m -> !m.isInternalApi() && !m.isResumableUpload())
.collect(Collectors.toList());
Optional<Method> methodOpt =
publicMethods.isEmpty()
Expand Down Expand Up @@ -311,12 +312,18 @@ private static List<MethodDefinition> createSettingsGetterMethods(
// Add method header comment statements and annotations.
private static MethodDefinition methodBuilderHelper(
Method protoMethod, MethodDefinition.Builder methodBuilder, String javaMethodName) {
return methodBuilder
.setHeaderCommentStatements(
SettingsCommentComposer.createCallSettingsGetterComment(
CommentStatement commentStatement =
protoMethod.isResumableUpload()
? SettingsCommentComposer.createResumableUploadCallSettingsGetterComment(
getMethodNameFromSettingsVarName(javaMethodName),
protoMethod.isDeprecated(),
protoMethod.isInternalApi())
: SettingsCommentComposer.createCallSettingsGetterComment(
getMethodNameFromSettingsVarName(javaMethodName),
protoMethod.isDeprecated(),
protoMethod.isInternalApi()))
protoMethod.isInternalApi());
return methodBuilder
.setHeaderCommentStatements(commentStatement)
.setAnnotations(createMethodAnnotations(protoMethod))
.build();
}
Expand Down Expand Up @@ -794,13 +801,19 @@ private static List<MethodDefinition> createNestedBuilderSettingsGetterMethods(
String javaMethodName = String.format("%sSettings", javaStyleName);
MethodDefinition.Builder methodBuilder =
methodMakerFn.apply(getCallSettingsBuilderType(protoMethod, typeStore), javaMethodName);
CommentStatement commentStatement =
protoMethod.isResumableUpload()
? SettingsCommentComposer.createResumableUploadCallSettingsBuilderGetterComment(
getMethodNameFromSettingsVarName(javaMethodName),
protoMethod.isDeprecated(),
protoMethod.isInternalApi())
: SettingsCommentComposer.createCallSettingsBuilderGetterComment(
getMethodNameFromSettingsVarName(javaMethodName),
protoMethod.isDeprecated(),
protoMethod.isInternalApi());
javaMethods.add(
methodBuilder
.setHeaderCommentStatements(
SettingsCommentComposer.createCallSettingsBuilderGetterComment(
getMethodNameFromSettingsVarName(javaMethodName),
protoMethod.isDeprecated(),
protoMethod.isInternalApi()))
.setHeaderCommentStatements(commentStatement)
.setAnnotations(createMethodAnnotations(protoMethod))
.build());

Expand Down Expand Up @@ -856,6 +869,7 @@ private static TypeStore createStaticTypes() {
Operation.class,
OperationCallSettings.class,
PagedCallSettings.class,
ResumableUploadCallSettings.class,
ServerStreamingCallSettings.class,
StreamingCallSettings.class,
StubSettings.class,
Expand Down Expand Up @@ -933,7 +947,13 @@ private static TypeNode getCallSettingsTypeHelper(
Method protoMethod, TypeStore typeStore, boolean isBuilder) {
Class<?> callSettingsClazz =
isBuilder ? UnaryCallSettings.Builder.class : UnaryCallSettings.class;
if (protoMethod.isPaged()) {
if (protoMethod.isResumableUpload()) {
return TypeNode.withReference(
ConcreteReference.withClazz(
isBuilder
? ResumableUploadCallSettings.Builder.class
: ResumableUploadCallSettings.class));
} else if (protoMethod.isPaged()) {
callSettingsClazz = isBuilder ? PagedCallSettings.Builder.class : PagedCallSettings.class;
} else if (protoMethod.isBatching()) {
callSettingsClazz =
Expand Down
Loading
Loading