Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit 747c5a0

Browse files
feat!: release gapic-generator-java v2.0.0 (#600)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/2a082ef0-c330-4a6e-9973-9c369e5572b8/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) PiperOrigin-RevId: 388535346 Source-Link: googleapis/googleapis@d9eaf41 PiperOrigin-RevId: 388499329 Source-Link: googleapis/googleapis@bb0a090
1 parent 1f87644 commit 747c5a0

28 files changed

+335
-560
lines changed

google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ImageAnnotatorSettings.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,13 @@ public ImageAnnotatorStubSettings.Builder getStubSettingsBuilder() {
193193
return ((ImageAnnotatorStubSettings.Builder) getStubSettings());
194194
}
195195

196-
// NEXT_MAJOR_VER: remove 'throws Exception'.
197196
/**
198197
* Applies the given settings updater function to all of the unary API methods in this service.
199198
*
200199
* <p>Note: This method does not support applying settings to streaming methods.
201200
*/
202201
public Builder applyToAllUnaryMethods(
203-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
202+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
204203
super.applyToAllUnaryMethods(
205204
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
206205
return this;

google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.cloud.vision.v1;
1818

19-
import com.google.api.core.ApiFunction;
2019
import com.google.api.core.ApiFuture;
2120
import com.google.api.core.ApiFutures;
2221
import com.google.api.core.BetaApi;
@@ -3300,12 +3299,7 @@ public static ApiFuture<ListProductSetsPagedResponse> createAsync(
33003299
ListProductSetsPage.createEmptyPage().createPageAsync(context, futureResponse);
33013300
return ApiFutures.transform(
33023301
futurePage,
3303-
new ApiFunction<ListProductSetsPage, ListProductSetsPagedResponse>() {
3304-
@Override
3305-
public ListProductSetsPagedResponse apply(ListProductSetsPage input) {
3306-
return new ListProductSetsPagedResponse(input);
3307-
}
3308-
},
3302+
input -> new ListProductSetsPagedResponse(input),
33093303
MoreExecutors.directExecutor());
33103304
}
33113305

@@ -3382,12 +3376,7 @@ public static ApiFuture<ListProductsPagedResponse> createAsync(
33823376
ListProductsPage.createEmptyPage().createPageAsync(context, futureResponse);
33833377
return ApiFutures.transform(
33843378
futurePage,
3385-
new ApiFunction<ListProductsPage, ListProductsPagedResponse>() {
3386-
@Override
3387-
public ListProductsPagedResponse apply(ListProductsPage input) {
3388-
return new ListProductsPagedResponse(input);
3389-
}
3390-
},
3379+
input -> new ListProductsPagedResponse(input),
33913380
MoreExecutors.directExecutor());
33923381
}
33933382

@@ -3463,12 +3452,7 @@ public static ApiFuture<ListReferenceImagesPagedResponse> createAsync(
34633452
ListReferenceImagesPage.createEmptyPage().createPageAsync(context, futureResponse);
34643453
return ApiFutures.transform(
34653454
futurePage,
3466-
new ApiFunction<ListReferenceImagesPage, ListReferenceImagesPagedResponse>() {
3467-
@Override
3468-
public ListReferenceImagesPagedResponse apply(ListReferenceImagesPage input) {
3469-
return new ListReferenceImagesPagedResponse(input);
3470-
}
3471-
},
3455+
input -> new ListReferenceImagesPagedResponse(input),
34723456
MoreExecutors.directExecutor());
34733457
}
34743458

@@ -3552,12 +3536,7 @@ public static ApiFuture<ListProductsInProductSetPagedResponse> createAsync(
35523536
ListProductsInProductSetPage.createEmptyPage().createPageAsync(context, futureResponse);
35533537
return ApiFutures.transform(
35543538
futurePage,
3555-
new ApiFunction<ListProductsInProductSetPage, ListProductsInProductSetPagedResponse>() {
3556-
@Override
3557-
public ListProductsInProductSetPagedResponse apply(ListProductsInProductSetPage input) {
3558-
return new ListProductsInProductSetPagedResponse(input);
3559-
}
3560-
},
3539+
input -> new ListProductsInProductSetPagedResponse(input),
35613540
MoreExecutors.directExecutor());
35623541
}
35633542

google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchSettings.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,13 @@ public ProductSearchStubSettings.Builder getStubSettingsBuilder() {
278278
return ((ProductSearchStubSettings.Builder) getStubSettings());
279279
}
280280

281-
// NEXT_MAJOR_VER: remove 'throws Exception'.
282281
/**
283282
* Applies the given settings updater function to all of the unary API methods in this service.
284283
*
285284
* <p>Note: This method does not support applying settings to streaming methods.
286285
*/
287286
public Builder applyToAllUnaryMethods(
288-
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
287+
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
289288
super.applyToAllUnaryMethods(
290289
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
291290
return this;

google-cloud-vision/src/main/java/com/google/cloud/vision/v1/stub/GrpcImageAnnotatorStub.java

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.api.gax.grpc.GrpcStubCallableFactory;
2323
import com.google.api.gax.rpc.ClientContext;
2424
import com.google.api.gax.rpc.OperationCallable;
25-
import com.google.api.gax.rpc.RequestParamsExtractor;
2625
import com.google.api.gax.rpc.UnaryCallable;
2726
import com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest;
2827
import com.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse;
@@ -39,7 +38,6 @@
3938
import io.grpc.MethodDescriptor;
4039
import io.grpc.protobuf.ProtoUtils;
4140
import java.io.IOException;
42-
import java.util.Map;
4341
import java.util.concurrent.TimeUnit;
4442
import javax.annotation.Generated;
4543

@@ -157,55 +155,43 @@ protected GrpcImageAnnotatorStub(
157155
GrpcCallSettings.<BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>newBuilder()
158156
.setMethodDescriptor(batchAnnotateImagesMethodDescriptor)
159157
.setParamsExtractor(
160-
new RequestParamsExtractor<BatchAnnotateImagesRequest>() {
161-
@Override
162-
public Map<String, String> extract(BatchAnnotateImagesRequest request) {
163-
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
164-
params.put("parent", String.valueOf(request.getParent()));
165-
return params.build();
166-
}
158+
request -> {
159+
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
160+
params.put("parent", String.valueOf(request.getParent()));
161+
return params.build();
167162
})
168163
.build();
169164
GrpcCallSettings<BatchAnnotateFilesRequest, BatchAnnotateFilesResponse>
170165
batchAnnotateFilesTransportSettings =
171166
GrpcCallSettings.<BatchAnnotateFilesRequest, BatchAnnotateFilesResponse>newBuilder()
172167
.setMethodDescriptor(batchAnnotateFilesMethodDescriptor)
173168
.setParamsExtractor(
174-
new RequestParamsExtractor<BatchAnnotateFilesRequest>() {
175-
@Override
176-
public Map<String, String> extract(BatchAnnotateFilesRequest request) {
177-
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
178-
params.put("parent", String.valueOf(request.getParent()));
179-
return params.build();
180-
}
169+
request -> {
170+
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
171+
params.put("parent", String.valueOf(request.getParent()));
172+
return params.build();
181173
})
182174
.build();
183175
GrpcCallSettings<AsyncBatchAnnotateImagesRequest, Operation>
184176
asyncBatchAnnotateImagesTransportSettings =
185177
GrpcCallSettings.<AsyncBatchAnnotateImagesRequest, Operation>newBuilder()
186178
.setMethodDescriptor(asyncBatchAnnotateImagesMethodDescriptor)
187179
.setParamsExtractor(
188-
new RequestParamsExtractor<AsyncBatchAnnotateImagesRequest>() {
189-
@Override
190-
public Map<String, String> extract(AsyncBatchAnnotateImagesRequest request) {
191-
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
192-
params.put("parent", String.valueOf(request.getParent()));
193-
return params.build();
194-
}
180+
request -> {
181+
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
182+
params.put("parent", String.valueOf(request.getParent()));
183+
return params.build();
195184
})
196185
.build();
197186
GrpcCallSettings<AsyncBatchAnnotateFilesRequest, Operation>
198187
asyncBatchAnnotateFilesTransportSettings =
199188
GrpcCallSettings.<AsyncBatchAnnotateFilesRequest, Operation>newBuilder()
200189
.setMethodDescriptor(asyncBatchAnnotateFilesMethodDescriptor)
201190
.setParamsExtractor(
202-
new RequestParamsExtractor<AsyncBatchAnnotateFilesRequest>() {
203-
@Override
204-
public Map<String, String> extract(AsyncBatchAnnotateFilesRequest request) {
205-
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
206-
params.put("parent", String.valueOf(request.getParent()));
207-
return params.build();
208-
}
191+
request -> {
192+
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
193+
params.put("parent", String.valueOf(request.getParent()));
194+
return params.build();
209195
})
210196
.build();
211197

@@ -290,7 +276,13 @@ public GrpcOperationsStub getOperationsStub() {
290276

291277
@Override
292278
public final void close() {
293-
shutdown();
279+
try {
280+
backgroundResources.close();
281+
} catch (RuntimeException e) {
282+
throw e;
283+
} catch (Exception e) {
284+
throw new IllegalStateException("Failed to close resource", e);
285+
}
294286
}
295287

296288
@Override

0 commit comments

Comments
 (0)