Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
feat!: release gapic-generator-java v2.0.0 (#719)
Browse files Browse the repository at this point in the history
Committer: @miraleung
PiperOrigin-RevId: 388535346

Source-Link: googleapis/googleapis@d9eaf41

Source-Link: googleapis/googleapis-gen@976c5ab
  • Loading branch information
gcf-owl-bot[bot] committed Aug 4, 2021
1 parent 68eb2a6 commit 984e09c
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 154 deletions.
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.translate.v3;

import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
Expand Down Expand Up @@ -1383,12 +1382,7 @@ public static ApiFuture<ListGlossariesPagedResponse> createAsync(
ListGlossariesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
new ApiFunction<ListGlossariesPage, ListGlossariesPagedResponse>() {
@Override
public ListGlossariesPagedResponse apply(ListGlossariesPage input) {
return new ListGlossariesPagedResponse(input);
}
},
input -> new ListGlossariesPagedResponse(input),
MoreExecutors.directExecutor());
}

Expand Down
Expand Up @@ -221,14 +221,13 @@ public TranslationServiceStubSettings.Builder getStubSettingsBuilder() {
return ((TranslationServiceStubSettings.Builder) getStubSettings());
}

// NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
super.applyToAllUnaryMethods(
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
return this;
Expand Down
Expand Up @@ -24,7 +24,6 @@
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.RequestParamsExtractor;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.translate.v3.BatchTranslateMetadata;
import com.google.cloud.translate.v3.BatchTranslateResponse;
Expand All @@ -50,7 +49,6 @@
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

Expand Down Expand Up @@ -213,107 +211,83 @@ protected GrpcTranslationServiceStub(
GrpcCallSettings.<TranslateTextRequest, TranslateTextResponse>newBuilder()
.setMethodDescriptor(translateTextMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<TranslateTextRequest>() {
@Override
public Map<String, String> extract(TranslateTextRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<DetectLanguageRequest, DetectLanguageResponse>
detectLanguageTransportSettings =
GrpcCallSettings.<DetectLanguageRequest, DetectLanguageResponse>newBuilder()
.setMethodDescriptor(detectLanguageMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<DetectLanguageRequest>() {
@Override
public Map<String, String> extract(DetectLanguageRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<GetSupportedLanguagesRequest, SupportedLanguages>
getSupportedLanguagesTransportSettings =
GrpcCallSettings.<GetSupportedLanguagesRequest, SupportedLanguages>newBuilder()
.setMethodDescriptor(getSupportedLanguagesMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<GetSupportedLanguagesRequest>() {
@Override
public Map<String, String> extract(GetSupportedLanguagesRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<BatchTranslateTextRequest, Operation> batchTranslateTextTransportSettings =
GrpcCallSettings.<BatchTranslateTextRequest, Operation>newBuilder()
.setMethodDescriptor(batchTranslateTextMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<BatchTranslateTextRequest>() {
@Override
public Map<String, String> extract(BatchTranslateTextRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<CreateGlossaryRequest, Operation> createGlossaryTransportSettings =
GrpcCallSettings.<CreateGlossaryRequest, Operation>newBuilder()
.setMethodDescriptor(createGlossaryMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<CreateGlossaryRequest>() {
@Override
public Map<String, String> extract(CreateGlossaryRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<ListGlossariesRequest, ListGlossariesResponse>
listGlossariesTransportSettings =
GrpcCallSettings.<ListGlossariesRequest, ListGlossariesResponse>newBuilder()
.setMethodDescriptor(listGlossariesMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<ListGlossariesRequest>() {
@Override
public Map<String, String> extract(ListGlossariesRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<GetGlossaryRequest, Glossary> getGlossaryTransportSettings =
GrpcCallSettings.<GetGlossaryRequest, Glossary>newBuilder()
.setMethodDescriptor(getGlossaryMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<GetGlossaryRequest>() {
@Override
public Map<String, String> extract(GetGlossaryRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
})
.build();
GrpcCallSettings<DeleteGlossaryRequest, Operation> deleteGlossaryTransportSettings =
GrpcCallSettings.<DeleteGlossaryRequest, Operation>newBuilder()
.setMethodDescriptor(deleteGlossaryMethodDescriptor)
.setParamsExtractor(
new RequestParamsExtractor<DeleteGlossaryRequest>() {
@Override
public Map<String, String> extract(DeleteGlossaryRequest request) {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
}
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("name", String.valueOf(request.getName()));
return params.build();
})
.build();

Expand Down Expand Up @@ -443,7 +417,13 @@ public UnaryCallable<DeleteGlossaryRequest, Operation> deleteGlossaryCallable()

@Override
public final void close() {
shutdown();
try {
backgroundResources.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}

@Override
Expand Down
Expand Up @@ -602,14 +602,13 @@ private static Builder initDefaults(Builder builder) {
return builder;
}

// NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
return this;
}
Expand Down
Expand Up @@ -16,7 +16,6 @@

package com.google.cloud.translate.v3beta1;

import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
Expand Down Expand Up @@ -1367,12 +1366,7 @@ public static ApiFuture<ListGlossariesPagedResponse> createAsync(
ListGlossariesPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
new ApiFunction<ListGlossariesPage, ListGlossariesPagedResponse>() {
@Override
public ListGlossariesPagedResponse apply(ListGlossariesPage input) {
return new ListGlossariesPagedResponse(input);
}
},
input -> new ListGlossariesPagedResponse(input),
MoreExecutors.directExecutor());
}

Expand Down
Expand Up @@ -244,14 +244,13 @@ public TranslationServiceStubSettings.Builder getStubSettingsBuilder() {
return ((TranslationServiceStubSettings.Builder) getStubSettings());
}

// NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
super.applyToAllUnaryMethods(
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
return this;
Expand Down

0 comments on commit 984e09c

Please sign in to comment.