diff --git a/generation_config.yaml b/generation_config.yaml index 38eee766d72a..b30c228ecb60 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -882,8 +882,6 @@ libraries: issue_tracker: https://issuetracker.google.com/savedsearches/559755 GAPICs: - proto_path: google/cloud/documentai/v1 - - proto_path: google/cloud/documentai/v1beta1 - - proto_path: google/cloud/documentai/v1beta2 - proto_path: google/cloud/documentai/v1beta3 - api_shortname: domains diff --git a/java-document-ai/google-cloud-document-ai-bom/pom.xml b/java-document-ai/google-cloud-document-ai-bom/pom.xml index 7611160b331c..f61123b1860d 100644 --- a/java-document-ai/google-cloud-document-ai-bom/pom.xml +++ b/java-document-ai/google-cloud-document-ai-bom/pom.xml @@ -23,16 +23,6 @@ google-cloud-document-ai 2.56.0-SNAPSHOT - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta1 - 0.68.0-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta2 - 0.68.0-SNAPSHOT - com.google.api.grpc grpc-google-cloud-document-ai-v1beta3 @@ -43,16 +33,6 @@ grpc-google-cloud-document-ai-v1 2.56.0-SNAPSHOT - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta1 - 0.68.0-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta2 - 0.68.0-SNAPSHOT - com.google.api.grpc proto-google-cloud-document-ai-v1beta3 diff --git a/java-document-ai/google-cloud-document-ai/pom.xml b/java-document-ai/google-cloud-document-ai/pom.xml index f8bb5c03b446..9af2bcc20df1 100644 --- a/java-document-ai/google-cloud-document-ai/pom.xml +++ b/java-document-ai/google-cloud-document-ai/pom.xml @@ -45,14 +45,6 @@ com.google.api.grpc proto-google-cloud-document-ai-v1 - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta1 - - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta2 - com.google.api.grpc proto-google-cloud-document-ai-v1beta3 @@ -84,21 +76,11 @@ junit test - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta1 - test - com.google.api.grpc grpc-google-cloud-document-ai-v1 test - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta2 - test - com.google.api.grpc grpc-google-cloud-document-ai-v1beta3 diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java deleted file mode 100644 index 0355f4cd291f..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.longrunning.OperationFuture; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.documentai.v1beta1.stub.DocumentUnderstandingServiceStub; -import com.google.cloud.documentai.v1beta1.stub.DocumentUnderstandingServiceStubSettings; -import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Service Description: Service to parse structured information from unstructured or semi-structured - * documents using state-of-the-art Google AI such as natural language, computer vision, and - * translation. - * - *

This class provides the ability to make remote calls to the backing service through method - * calls that map to API methods. Sample code to get started: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create()) {
- *   List requests = new ArrayList<>();
- *   BatchProcessDocumentsResponse response =
- *       documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
- * }
- * }
- * - *

Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up - * resources such as threads. In the example above, try-with-resources is used, which automatically - * calls close(). - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Methods
MethodDescriptionMethod Variants

BatchProcessDocuments

LRO endpoint to batch process many documents.

- *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

- *
    - *
  • batchProcessDocumentsAsync(List<ProcessDocumentRequest> requests) - *

  • batchProcessDocumentsAsync(BatchProcessDocumentsRequest request) - *

- *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

- *
    - *
  • batchProcessDocumentsOperationCallable() - *

  • batchProcessDocumentsCallable() - *

- *
- * - *

See the individual methods for example code. - * - *

Many parameters require resource names to be formatted in a particular way. To assist with - * these names, this class includes a format method for each type of name, and additionally a parse - * method to extract the individual identifiers contained within names that are returned. - * - *

This class can be customized by passing in a custom instance of - * DocumentUnderstandingServiceSettings to create(). For example: - * - *

To customize credentials: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
- *     DocumentUnderstandingServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
- *     DocumentUnderstandingServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
- * }
- * - *

Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceClient implements BackgroundResource { - private final DocumentUnderstandingServiceSettings settings; - private final DocumentUnderstandingServiceStub stub; - private final OperationsClient operationsClient; - - /** Constructs an instance of DocumentUnderstandingServiceClient with default settings. */ - public static final DocumentUnderstandingServiceClient create() throws IOException { - return create(DocumentUnderstandingServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of DocumentUnderstandingServiceClient, using the given settings. The - * channels are created based on the settings passed in, or defaults for any settings that are not - * set. - */ - public static final DocumentUnderstandingServiceClient create( - DocumentUnderstandingServiceSettings settings) throws IOException { - return new DocumentUnderstandingServiceClient(settings); - } - - /** - * Constructs an instance of DocumentUnderstandingServiceClient, using the given stub for making - * calls. This is for advanced usage - prefer using create(DocumentUnderstandingServiceSettings). - */ - public static final DocumentUnderstandingServiceClient create( - DocumentUnderstandingServiceStub stub) { - return new DocumentUnderstandingServiceClient(stub); - } - - /** - * Constructs an instance of DocumentUnderstandingServiceClient, using the given settings. This is - * protected so that it is easy to make a subclass, but otherwise, the static factory methods - * should be preferred. - */ - protected DocumentUnderstandingServiceClient(DocumentUnderstandingServiceSettings settings) - throws IOException { - this.settings = settings; - this.stub = - ((DocumentUnderstandingServiceStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); - } - - protected DocumentUnderstandingServiceClient(DocumentUnderstandingServiceStub stub) { - this.settings = null; - this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); - } - - public final DocumentUnderstandingServiceSettings getSettings() { - return settings; - } - - public DocumentUnderstandingServiceStub getStub() { - return stub; - } - - /** - * Returns the OperationsClient that can be used to query the status of a long-running operation - * returned by another API method call. - */ - public final OperationsClient getOperationsClient() { - return operationsClient; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   List requests = new ArrayList<>();
-   *   BatchProcessDocumentsResponse response =
-   *       documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
-   * }
-   * }
- * - * @param requests Required. Individual requests for each document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture - batchProcessDocumentsAsync(List requests) { - BatchProcessDocumentsRequest request = - BatchProcessDocumentsRequest.newBuilder().addAllRequests(requests).build(); - return batchProcessDocumentsAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   BatchProcessDocumentsRequest request =
-   *       BatchProcessDocumentsRequest.newBuilder()
-   *           .addAllRequests(new ArrayList())
-   *           .setParent("parent-995424086")
-   *           .build();
-   *   BatchProcessDocumentsResponse response =
-   *       documentUnderstandingServiceClient.batchProcessDocumentsAsync(request).get();
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture - batchProcessDocumentsAsync(BatchProcessDocumentsRequest request) { - return batchProcessDocumentsOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   BatchProcessDocumentsRequest request =
-   *       BatchProcessDocumentsRequest.newBuilder()
-   *           .addAllRequests(new ArrayList())
-   *           .setParent("parent-995424086")
-   *           .build();
-   *   OperationFuture future =
-   *       documentUnderstandingServiceClient
-   *           .batchProcessDocumentsOperationCallable()
-   *           .futureCall(request);
-   *   // Do something.
-   *   BatchProcessDocumentsResponse response = future.get();
-   * }
-   * }
- */ - public final OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable() { - return stub.batchProcessDocumentsOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   BatchProcessDocumentsRequest request =
-   *       BatchProcessDocumentsRequest.newBuilder()
-   *           .addAllRequests(new ArrayList())
-   *           .setParent("parent-995424086")
-   *           .build();
-   *   ApiFuture future =
-   *       documentUnderstandingServiceClient.batchProcessDocumentsCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - batchProcessDocumentsCallable() { - return stub.batchProcessDocumentsCallable(); - } - - @Override - public final void close() { - stub.close(); - } - - @Override - public void shutdown() { - stub.shutdown(); - } - - @Override - public boolean isShutdown() { - return stub.isShutdown(); - } - - @Override - public boolean isTerminated() { - return stub.isTerminated(); - } - - @Override - public void shutdownNow() { - stub.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return stub.awaitTermination(duration, unit); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceSettings.java deleted file mode 100644 index bcbbe8304059..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceSettings.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1; - -import com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientSettings; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.documentai.v1beta1.stub.DocumentUnderstandingServiceStubSettings; -import com.google.longrunning.Operation; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link DocumentUnderstandingServiceClient}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (documentai.googleapis.com) and default port (443) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the - * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) - * of batchProcessDocuments: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceSettings.newBuilder();
- * documentUnderstandingServiceSettingsBuilder
- *     .batchProcessDocumentsSettings()
- *     .setRetrySettings(
- *         documentUnderstandingServiceSettingsBuilder
- *             .batchProcessDocumentsSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
- *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
- *             .setMaxAttempts(5)
- *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
- *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
- *             .setRetryDelayMultiplier(1.3)
- *             .setRpcTimeoutMultiplier(1.5)
- *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
- *             .build());
- * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
- *     documentUnderstandingServiceSettingsBuilder.build();
- * }
- * - * Please refer to the [Client Side Retry - * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for - * additional support in setting retries. - * - *

To configure the RetrySettings of a Long Running Operation method, create an - * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to - * configure the RetrySettings for batchProcessDocuments: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceSettings.newBuilder();
- * TimedRetryAlgorithm timedRetryAlgorithm =
- *     OperationalTimedPollAlgorithm.create(
- *         RetrySettings.newBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofMillis(500))
- *             .setRetryDelayMultiplier(1.5)
- *             .setMaxRetryDelay(Duration.ofMillis(5000))
- *             .setTotalTimeoutDuration(Duration.ofHours(24))
- *             .build());
- * documentUnderstandingServiceSettingsBuilder
- *     .createClusterOperationSettings()
- *     .setPollingAlgorithm(timedRetryAlgorithm)
- *     .build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceSettings - extends ClientSettings { - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings - batchProcessDocumentsSettings() { - return ((DocumentUnderstandingServiceStubSettings) getStubSettings()) - .batchProcessDocumentsSettings(); - } - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return ((DocumentUnderstandingServiceStubSettings) getStubSettings()) - .batchProcessDocumentsOperationSettings(); - } - - public static final DocumentUnderstandingServiceSettings create( - DocumentUnderstandingServiceStubSettings stub) throws IOException { - return new DocumentUnderstandingServiceSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return DocumentUnderstandingServiceStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DocumentUnderstandingServiceStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return DocumentUnderstandingServiceStubSettings.defaultTransportChannelProvider(); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultApiClientHeaderProviderBuilder(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected DocumentUnderstandingServiceSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for DocumentUnderstandingServiceSettings. */ - public static class Builder - extends ClientSettings.Builder { - - protected Builder() throws IOException { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(DocumentUnderstandingServiceStubSettings.newBuilder(clientContext)); - } - - protected Builder(DocumentUnderstandingServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(DocumentUnderstandingServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - private static Builder createDefault() { - return new Builder(DocumentUnderstandingServiceStubSettings.newBuilder()); - } - - public DocumentUnderstandingServiceStubSettings.Builder getStubSettingsBuilder() { - return ((DocumentUnderstandingServiceStubSettings.Builder) getStubSettings()); - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings.Builder - batchProcessDocumentsSettings() { - return getStubSettingsBuilder().batchProcessDocumentsSettings(); - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings.Builder< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return getStubSettingsBuilder().batchProcessDocumentsOperationSettings(); - } - - @Override - public DocumentUnderstandingServiceSettings build() throws IOException { - return new DocumentUnderstandingServiceSettings(this); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/gapic_metadata.json b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/gapic_metadata.json deleted file mode 100644 index 62c7a3bc002e..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/gapic_metadata.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "java", - "protoPackage": "google.cloud.documentai.v1beta1", - "libraryPackage": "com.google.cloud.documentai.v1beta1", - "services": { - "DocumentUnderstandingService": { - "clients": { - "grpc": { - "libraryClient": "DocumentUnderstandingServiceClient", - "rpcs": { - "BatchProcessDocuments": { - "methods": ["batchProcessDocumentsAsync", "batchProcessDocumentsAsync", "batchProcessDocumentsOperationCallable", "batchProcessDocumentsCallable"] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java deleted file mode 100644 index 61fce7ac2ee2..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A client to Cloud Document AI API - * - *

The interfaces provided are listed below, along with usage samples. - * - *

======================= DocumentUnderstandingServiceClient ======================= - * - *

Service Description: Service to parse structured information from unstructured or - * semi-structured documents using state-of-the-art Google AI such as natural language, computer - * vision, and translation. - * - *

Sample for DocumentUnderstandingServiceClient: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create()) {
- *   List requests = new ArrayList<>();
- *   BatchProcessDocumentsResponse response =
- *       documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
- * }
- * }
- */ -@Generated("by gapic-generator-java") -package com.google.cloud.documentai.v1beta1; - -import javax.annotation.Generated; diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java deleted file mode 100644 index 2abca75aa33a..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; -import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; -import com.google.cloud.documentai.v1beta1.OperationMetadata; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Base stub class for the DocumentUnderstandingService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public abstract class DocumentUnderstandingServiceStub implements BackgroundResource { - - public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); - } - - public OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable() { - throw new UnsupportedOperationException( - "Not implemented: batchProcessDocumentsOperationCallable()"); - } - - public UnaryCallable batchProcessDocumentsCallable() { - throw new UnsupportedOperationException("Not implemented: batchProcessDocumentsCallable()"); - } - - @Override - public abstract void close(); -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java deleted file mode 100644 index e311ae88acf2..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1.stub; - -import com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.core.ObsoleteApi; -import com.google.api.gax.core.GaxProperties; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.GrpcTransportChannel; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.grpc.ProtoOperationTransformers; -import com.google.api.gax.longrunning.OperationSnapshot; -import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.StubSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; -import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; -import com.google.cloud.documentai.v1beta1.OperationMetadata; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.longrunning.Operation; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; -import org.threeten.bp.Duration; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link DocumentUnderstandingServiceStub}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (documentai.googleapis.com) and default port (443) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the - * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) - * of batchProcessDocuments: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceStubSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceStubSettings.newBuilder();
- * documentUnderstandingServiceSettingsBuilder
- *     .batchProcessDocumentsSettings()
- *     .setRetrySettings(
- *         documentUnderstandingServiceSettingsBuilder
- *             .batchProcessDocumentsSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
- *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
- *             .setMaxAttempts(5)
- *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
- *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
- *             .setRetryDelayMultiplier(1.3)
- *             .setRpcTimeoutMultiplier(1.5)
- *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
- *             .build());
- * DocumentUnderstandingServiceStubSettings documentUnderstandingServiceSettings =
- *     documentUnderstandingServiceSettingsBuilder.build();
- * }
- * - * Please refer to the [Client Side Retry - * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for - * additional support in setting retries. - * - *

To configure the RetrySettings of a Long Running Operation method, create an - * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to - * configure the RetrySettings for batchProcessDocuments: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceStubSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceStubSettings.newBuilder();
- * TimedRetryAlgorithm timedRetryAlgorithm =
- *     OperationalTimedPollAlgorithm.create(
- *         RetrySettings.newBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofMillis(500))
- *             .setRetryDelayMultiplier(1.5)
- *             .setMaxRetryDelay(Duration.ofMillis(5000))
- *             .setTotalTimeoutDuration(Duration.ofHours(24))
- *             .build());
- * documentUnderstandingServiceSettingsBuilder
- *     .createClusterOperationSettings()
- *     .setPollingAlgorithm(timedRetryAlgorithm)
- *     .build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceStubSettings - extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); - - private final UnaryCallSettings - batchProcessDocumentsSettings; - private final OperationCallSettings< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings; - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings - batchProcessDocumentsSettings() { - return batchProcessDocumentsSettings; - } - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return batchProcessDocumentsOperationSettings; - } - - public DocumentUnderstandingServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcDocumentUnderstandingServiceStub.create(this); - } - throw new UnsupportedOperationException( - String.format( - "Transport not supported: %s", getTransportChannelProvider().getTransportName())); - } - - /** Returns the default service name. */ - @Override - public String getServiceName() { - return "documentai"; - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - @ObsoleteApi("Use getEndpoint() instead") - public static String getDefaultEndpoint() { - return "documentai.googleapis.com:443"; - } - - /** Returns the default mTLS service endpoint. */ - public static String getDefaultMtlsEndpoint() { - return "documentai.mtls.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder() - .setScopesToApply(DEFAULT_SERVICE_SCOPES) - .setUseJwtAccessWithScope(true); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", - GaxProperties.getLibraryVersion(DocumentUnderstandingServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected DocumentUnderstandingServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - batchProcessDocumentsSettings = settingsBuilder.batchProcessDocumentsSettings().build(); - batchProcessDocumentsOperationSettings = - settingsBuilder.batchProcessDocumentsOperationSettings().build(); - } - - /** Builder for DocumentUnderstandingServiceStubSettings. */ - public static class Builder - extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder - batchProcessDocumentsSettings; - private final OperationCallSettings.Builder< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings; - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "retry_policy_0_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(60000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(60000L)) - .setTotalTimeout(Duration.ofMillis(60000L)) - .build(); - definitions.put("retry_policy_0_params", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - batchProcessDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - batchProcessDocumentsOperationSettings = OperationCallSettings.newBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(batchProcessDocumentsSettings); - initDefaults(this); - } - - protected Builder(DocumentUnderstandingServiceStubSettings settings) { - super(settings); - - batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder(); - batchProcessDocumentsOperationSettings = - settings.batchProcessDocumentsOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of(batchProcessDocumentsSettings); - } - - private static Builder createDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - builder - .batchProcessDocumentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .batchProcessDocumentsOperationSettings() - .setInitialCallSettings( - UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) - .build()) - .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create( - BatchProcessDocumentsResponse.class)) - .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) - .setPollingAlgorithm( - OperationTimedPollAlgorithm.create( - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(5000L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(45000L)) - .setInitialRpcTimeout(Duration.ZERO) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ZERO) - .setTotalTimeout(Duration.ofMillis(300000L)) - .build())); - - return builder; - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings.Builder - batchProcessDocumentsSettings() { - return batchProcessDocumentsSettings; - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings.Builder< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return batchProcessDocumentsOperationSettings; - } - - @Override - public DocumentUnderstandingServiceStubSettings build() throws IOException { - return new DocumentUnderstandingServiceStubSettings(this); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java deleted file mode 100644 index 72228930c2f7..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcCallableFactory; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC callable factory implementation for the DocumentUnderstandingService service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcDocumentUnderstandingServiceCallableFactory implements GrpcStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - GrpcCallSettings grpcCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - GrpcCallSettings grpcCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, callSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java deleted file mode 100644 index f09c6235b859..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.grpc.GrpcCallSettings; -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.RequestParamsBuilder; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; -import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; -import com.google.cloud.documentai.v1beta1.OperationMetadata; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.GrpcOperationsStub; -import io.grpc.MethodDescriptor; -import io.grpc.protobuf.ProtoUtils; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC stub implementation for the DocumentUnderstandingService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingServiceStub { - private static final MethodDescriptor - batchProcessDocumentsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.documentai.v1beta1.DocumentUnderstandingService/BatchProcessDocuments") - .setRequestMarshaller( - ProtoUtils.marshaller(BatchProcessDocumentsRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); - - private final UnaryCallable - batchProcessDocumentsCallable; - private final OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable; - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final GrpcStubCallableFactory callableFactory; - - public static final GrpcDocumentUnderstandingServiceStub create( - DocumentUnderstandingServiceStubSettings settings) throws IOException { - return new GrpcDocumentUnderstandingServiceStub(settings, ClientContext.create(settings)); - } - - public static final GrpcDocumentUnderstandingServiceStub create(ClientContext clientContext) - throws IOException { - return new GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings.newBuilder().build(), clientContext); - } - - public static final GrpcDocumentUnderstandingServiceStub create( - ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { - return new GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings.newBuilder().build(), - clientContext, - callableFactory); - } - - /** - * Constructs an instance of GrpcDocumentUnderstandingServiceStub, using the given settings. This - * is protected so that it is easy to make a subclass, but otherwise, the static factory methods - * should be preferred. - */ - protected GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings settings, ClientContext clientContext) - throws IOException { - this(settings, clientContext, new GrpcDocumentUnderstandingServiceCallableFactory()); - } - - /** - * Constructs an instance of GrpcDocumentUnderstandingServiceStub, using the given settings. This - * is protected so that it is easy to make a subclass, but otherwise, the static factory methods - * should be preferred. - */ - protected GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings settings, - ClientContext clientContext, - GrpcStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - - GrpcCallSettings - batchProcessDocumentsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(batchProcessDocumentsMethodDescriptor) - .setParamsExtractor( - request -> { - RequestParamsBuilder builder = RequestParamsBuilder.create(); - builder.add("parent", String.valueOf(request.getParent())); - return builder.build(); - }) - .build(); - - this.batchProcessDocumentsCallable = - callableFactory.createUnaryCallable( - batchProcessDocumentsTransportSettings, - settings.batchProcessDocumentsSettings(), - clientContext); - this.batchProcessDocumentsOperationCallable = - callableFactory.createOperationCallable( - batchProcessDocumentsTransportSettings, - settings.batchProcessDocumentsOperationSettings(), - clientContext, - operationsStub); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - @Override - public UnaryCallable batchProcessDocumentsCallable() { - return batchProcessDocumentsCallable; - } - - @Override - public OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable() { - return batchProcessDocumentsOperationCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClient.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClient.java deleted file mode 100644 index caf473fb281f..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClient.java +++ /dev/null @@ -1,729 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2; - -import com.google.api.core.ApiFuture; -import com.google.api.core.ApiFutures; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.longrunning.OperationFuture; -import com.google.api.gax.paging.AbstractFixedSizeCollection; -import com.google.api.gax.paging.AbstractPage; -import com.google.api.gax.paging.AbstractPagedListResponse; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.documentai.v1beta2.stub.DocumentUnderstandingServiceStub; -import com.google.cloud.documentai.v1beta2.stub.DocumentUnderstandingServiceStubSettings; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.util.concurrent.MoreExecutors; -import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Service Description: Service to parse structured information from unstructured or semi-structured - * documents using state-of-the-art Google AI such as natural language, computer vision, and - * translation. - * - *

This class provides the ability to make remote calls to the backing service through method - * calls that map to API methods. Sample code to get started: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create()) {
- *   ProcessDocumentRequest request =
- *       ProcessDocumentRequest.newBuilder()
- *           .setParent("parent-995424086")
- *           .setInputConfig(InputConfig.newBuilder().build())
- *           .setOutputConfig(OutputConfig.newBuilder().build())
- *           .setDocumentType("documentType-1473196299")
- *           .setTableExtractionParams(TableExtractionParams.newBuilder().build())
- *           .setFormExtractionParams(FormExtractionParams.newBuilder().build())
- *           .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
- *           .setOcrParams(OcrParams.newBuilder().build())
- *           .setAutomlParams(AutoMlParams.newBuilder().build())
- *           .build();
- *   Document response = documentUnderstandingServiceClient.processDocument(request);
- * }
- * }
- * - *

Note: close() needs to be called on the DocumentUnderstandingServiceClient object to clean up - * resources such as threads. In the example above, try-with-resources is used, which automatically - * calls close(). - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Methods
MethodDescriptionMethod Variants

BatchProcessDocuments

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

- *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

- *
    - *
  • batchProcessDocumentsAsync(List<ProcessDocumentRequest> requests) - *

  • batchProcessDocumentsAsync(BatchProcessDocumentsRequest request) - *

- *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

- *
    - *
  • batchProcessDocumentsOperationCallable() - *

  • batchProcessDocumentsCallable() - *

- *

ProcessDocument

Processes a single document.

- *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

- *
    - *
  • processDocument(ProcessDocumentRequest request) - *

- *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

- *
    - *
  • processDocumentCallable() - *

- *

ListLocations

Lists information about the supported locations for this service.

- *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

- *
    - *
  • listLocations(ListLocationsRequest request) - *

- *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

- *
    - *
  • listLocationsPagedCallable() - *

  • listLocationsCallable() - *

- *

GetLocation

Gets information about a location.

- *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

- *
    - *
  • getLocation(GetLocationRequest request) - *

- *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

- *
    - *
  • getLocationCallable() - *

- *
- * - *

See the individual methods for example code. - * - *

Many parameters require resource names to be formatted in a particular way. To assist with - * these names, this class includes a format method for each type of name, and additionally a parse - * method to extract the individual identifiers contained within names that are returned. - * - *

This class can be customized by passing in a custom instance of - * DocumentUnderstandingServiceSettings to create(). For example: - * - *

To customize credentials: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
- *     DocumentUnderstandingServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
- *     DocumentUnderstandingServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
- * }
- * - *

Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceClient implements BackgroundResource { - private final DocumentUnderstandingServiceSettings settings; - private final DocumentUnderstandingServiceStub stub; - private final OperationsClient operationsClient; - - /** Constructs an instance of DocumentUnderstandingServiceClient with default settings. */ - public static final DocumentUnderstandingServiceClient create() throws IOException { - return create(DocumentUnderstandingServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of DocumentUnderstandingServiceClient, using the given settings. The - * channels are created based on the settings passed in, or defaults for any settings that are not - * set. - */ - public static final DocumentUnderstandingServiceClient create( - DocumentUnderstandingServiceSettings settings) throws IOException { - return new DocumentUnderstandingServiceClient(settings); - } - - /** - * Constructs an instance of DocumentUnderstandingServiceClient, using the given stub for making - * calls. This is for advanced usage - prefer using create(DocumentUnderstandingServiceSettings). - */ - public static final DocumentUnderstandingServiceClient create( - DocumentUnderstandingServiceStub stub) { - return new DocumentUnderstandingServiceClient(stub); - } - - /** - * Constructs an instance of DocumentUnderstandingServiceClient, using the given settings. This is - * protected so that it is easy to make a subclass, but otherwise, the static factory methods - * should be preferred. - */ - protected DocumentUnderstandingServiceClient(DocumentUnderstandingServiceSettings settings) - throws IOException { - this.settings = settings; - this.stub = - ((DocumentUnderstandingServiceStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); - } - - protected DocumentUnderstandingServiceClient(DocumentUnderstandingServiceStub stub) { - this.settings = null; - this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); - } - - public final DocumentUnderstandingServiceSettings getSettings() { - return settings; - } - - public DocumentUnderstandingServiceStub getStub() { - return stub; - } - - /** - * Returns the OperationsClient that can be used to query the status of a long-running operation - * returned by another API method call. - */ - public final OperationsClient getOperationsClient() { - return operationsClient; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in - * the [Document] format. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   List requests = new ArrayList<>();
-   *   BatchProcessDocumentsResponse response =
-   *       documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
-   * }
-   * }
- * - * @param requests Required. Individual requests for each document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture - batchProcessDocumentsAsync(List requests) { - BatchProcessDocumentsRequest request = - BatchProcessDocumentsRequest.newBuilder().addAllRequests(requests).build(); - return batchProcessDocumentsAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in - * the [Document] format. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   BatchProcessDocumentsRequest request =
-   *       BatchProcessDocumentsRequest.newBuilder()
-   *           .addAllRequests(new ArrayList())
-   *           .setParent("parent-995424086")
-   *           .build();
-   *   BatchProcessDocumentsResponse response =
-   *       documentUnderstandingServiceClient.batchProcessDocumentsAsync(request).get();
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final OperationFuture - batchProcessDocumentsAsync(BatchProcessDocumentsRequest request) { - return batchProcessDocumentsOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in - * the [Document] format. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   BatchProcessDocumentsRequest request =
-   *       BatchProcessDocumentsRequest.newBuilder()
-   *           .addAllRequests(new ArrayList())
-   *           .setParent("parent-995424086")
-   *           .build();
-   *   OperationFuture future =
-   *       documentUnderstandingServiceClient
-   *           .batchProcessDocumentsOperationCallable()
-   *           .futureCall(request);
-   *   // Do something.
-   *   BatchProcessDocumentsResponse response = future.get();
-   * }
-   * }
- */ - public final OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable() { - return stub.batchProcessDocumentsOperationCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in - * the [Document] format. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   BatchProcessDocumentsRequest request =
-   *       BatchProcessDocumentsRequest.newBuilder()
-   *           .addAllRequests(new ArrayList())
-   *           .setParent("parent-995424086")
-   *           .build();
-   *   ApiFuture future =
-   *       documentUnderstandingServiceClient.batchProcessDocumentsCallable().futureCall(request);
-   *   // Do something.
-   *   Operation response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - batchProcessDocumentsCallable() { - return stub.batchProcessDocumentsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Processes a single document. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   ProcessDocumentRequest request =
-   *       ProcessDocumentRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setInputConfig(InputConfig.newBuilder().build())
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .setDocumentType("documentType-1473196299")
-   *           .setTableExtractionParams(TableExtractionParams.newBuilder().build())
-   *           .setFormExtractionParams(FormExtractionParams.newBuilder().build())
-   *           .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
-   *           .setOcrParams(OcrParams.newBuilder().build())
-   *           .setAutomlParams(AutoMlParams.newBuilder().build())
-   *           .build();
-   *   Document response = documentUnderstandingServiceClient.processDocument(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Document processDocument(ProcessDocumentRequest request) { - return processDocumentCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Processes a single document. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   ProcessDocumentRequest request =
-   *       ProcessDocumentRequest.newBuilder()
-   *           .setParent("parent-995424086")
-   *           .setInputConfig(InputConfig.newBuilder().build())
-   *           .setOutputConfig(OutputConfig.newBuilder().build())
-   *           .setDocumentType("documentType-1473196299")
-   *           .setTableExtractionParams(TableExtractionParams.newBuilder().build())
-   *           .setFormExtractionParams(FormExtractionParams.newBuilder().build())
-   *           .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
-   *           .setOcrParams(OcrParams.newBuilder().build())
-   *           .setAutomlParams(AutoMlParams.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       documentUnderstandingServiceClient.processDocumentCallable().futureCall(request);
-   *   // Do something.
-   *   Document response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable processDocumentCallable() { - return stub.processDocumentCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Location element :
-   *       documentUnderstandingServiceClient.listLocations(request).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { - return listLocationsPagedCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       documentUnderstandingServiceClient.listLocationsPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Location element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable - listLocationsPagedCallable() { - return stub.listLocationsPagedCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists information about the supported locations for this service. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   ListLocationsRequest request =
-   *       ListLocationsRequest.newBuilder()
-   *           .setName("name3373707")
-   *           .setFilter("filter-1274492040")
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListLocationsResponse response =
-   *         documentUnderstandingServiceClient.listLocationsCallable().call(request);
-   *     for (Location element : response.getLocationsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable listLocationsCallable() { - return stub.listLocationsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets information about a location. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   Location response = documentUnderstandingServiceClient.getLocation(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Location getLocation(GetLocationRequest request) { - return getLocationCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets information about a location. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - 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
-   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
-   *     DocumentUnderstandingServiceClient.create()) {
-   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
-   *   ApiFuture future =
-   *       documentUnderstandingServiceClient.getLocationCallable().futureCall(request);
-   *   // Do something.
-   *   Location response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable getLocationCallable() { - return stub.getLocationCallable(); - } - - @Override - public final void close() { - stub.close(); - } - - @Override - public void shutdown() { - stub.shutdown(); - } - - @Override - public boolean isShutdown() { - return stub.isShutdown(); - } - - @Override - public boolean isTerminated() { - return stub.isTerminated(); - } - - @Override - public void shutdownNow() { - stub.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return stub.awaitTermination(duration, unit); - } - - public static class ListLocationsPagedResponse - extends AbstractPagedListResponse< - ListLocationsRequest, - ListLocationsResponse, - Location, - ListLocationsPage, - ListLocationsFixedSizeCollection> { - - public static ApiFuture createAsync( - PageContext context, - ApiFuture futureResponse) { - ApiFuture futurePage = - ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); - return ApiFutures.transform( - futurePage, - input -> new ListLocationsPagedResponse(input), - MoreExecutors.directExecutor()); - } - - private ListLocationsPagedResponse(ListLocationsPage page) { - super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); - } - } - - public static class ListLocationsPage - extends AbstractPage< - ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { - - private ListLocationsPage( - PageContext context, - ListLocationsResponse response) { - super(context, response); - } - - private static ListLocationsPage createEmptyPage() { - return new ListLocationsPage(null, null); - } - - @Override - protected ListLocationsPage createPage( - PageContext context, - ListLocationsResponse response) { - return new ListLocationsPage(context, response); - } - - @Override - public ApiFuture createPageAsync( - PageContext context, - ApiFuture futureResponse) { - return super.createPageAsync(context, futureResponse); - } - } - - public static class ListLocationsFixedSizeCollection - extends AbstractFixedSizeCollection< - ListLocationsRequest, - ListLocationsResponse, - Location, - ListLocationsPage, - ListLocationsFixedSizeCollection> { - - private ListLocationsFixedSizeCollection(List pages, int collectionSize) { - super(pages, collectionSize); - } - - private static ListLocationsFixedSizeCollection createEmptyCollection() { - return new ListLocationsFixedSizeCollection(null, 0); - } - - @Override - protected ListLocationsFixedSizeCollection createCollection( - List pages, int collectionSize) { - return new ListLocationsFixedSizeCollection(pages, collectionSize); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceSettings.java deleted file mode 100644 index 8dc075224280..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceSettings.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2; - -import static com.google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient.ListLocationsPagedResponse; - -import com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -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.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.documentai.v1beta2.stub.DocumentUnderstandingServiceStubSettings; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.longrunning.Operation; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link DocumentUnderstandingServiceClient}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (documentai.googleapis.com) and default port (443) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the - * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) - * of processDocument: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceSettings.newBuilder();
- * documentUnderstandingServiceSettingsBuilder
- *     .processDocumentSettings()
- *     .setRetrySettings(
- *         documentUnderstandingServiceSettingsBuilder
- *             .processDocumentSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
- *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
- *             .setMaxAttempts(5)
- *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
- *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
- *             .setRetryDelayMultiplier(1.3)
- *             .setRpcTimeoutMultiplier(1.5)
- *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
- *             .build());
- * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
- *     documentUnderstandingServiceSettingsBuilder.build();
- * }
- * - * Please refer to the [Client Side Retry - * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for - * additional support in setting retries. - * - *

To configure the RetrySettings of a Long Running Operation method, create an - * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to - * configure the RetrySettings for batchProcessDocuments: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceSettings.newBuilder();
- * TimedRetryAlgorithm timedRetryAlgorithm =
- *     OperationalTimedPollAlgorithm.create(
- *         RetrySettings.newBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofMillis(500))
- *             .setRetryDelayMultiplier(1.5)
- *             .setMaxRetryDelay(Duration.ofMillis(5000))
- *             .setTotalTimeoutDuration(Duration.ofHours(24))
- *             .build());
- * documentUnderstandingServiceSettingsBuilder
- *     .createClusterOperationSettings()
- *     .setPollingAlgorithm(timedRetryAlgorithm)
- *     .build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceSettings - extends ClientSettings { - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings - batchProcessDocumentsSettings() { - return ((DocumentUnderstandingServiceStubSettings) getStubSettings()) - .batchProcessDocumentsSettings(); - } - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return ((DocumentUnderstandingServiceStubSettings) getStubSettings()) - .batchProcessDocumentsOperationSettings(); - } - - /** Returns the object with the settings used for calls to processDocument. */ - public UnaryCallSettings processDocumentSettings() { - return ((DocumentUnderstandingServiceStubSettings) getStubSettings()).processDocumentSettings(); - } - - /** Returns the object with the settings used for calls to listLocations. */ - public PagedCallSettings - listLocationsSettings() { - return ((DocumentUnderstandingServiceStubSettings) getStubSettings()).listLocationsSettings(); - } - - /** Returns the object with the settings used for calls to getLocation. */ - public UnaryCallSettings getLocationSettings() { - return ((DocumentUnderstandingServiceStubSettings) getStubSettings()).getLocationSettings(); - } - - public static final DocumentUnderstandingServiceSettings create( - DocumentUnderstandingServiceStubSettings stub) throws IOException { - return new DocumentUnderstandingServiceSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return DocumentUnderstandingServiceStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DocumentUnderstandingServiceStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return DocumentUnderstandingServiceStubSettings.defaultTransportChannelProvider(); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return DocumentUnderstandingServiceStubSettings.defaultApiClientHeaderProviderBuilder(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected DocumentUnderstandingServiceSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for DocumentUnderstandingServiceSettings. */ - public static class Builder - extends ClientSettings.Builder { - - protected Builder() throws IOException { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(DocumentUnderstandingServiceStubSettings.newBuilder(clientContext)); - } - - protected Builder(DocumentUnderstandingServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(DocumentUnderstandingServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - private static Builder createDefault() { - return new Builder(DocumentUnderstandingServiceStubSettings.newBuilder()); - } - - public DocumentUnderstandingServiceStubSettings.Builder getStubSettingsBuilder() { - return ((DocumentUnderstandingServiceStubSettings.Builder) getStubSettings()); - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings.Builder - batchProcessDocumentsSettings() { - return getStubSettingsBuilder().batchProcessDocumentsSettings(); - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings.Builder< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return getStubSettingsBuilder().batchProcessDocumentsOperationSettings(); - } - - /** Returns the builder for the settings used for calls to processDocument. */ - public UnaryCallSettings.Builder processDocumentSettings() { - return getStubSettingsBuilder().processDocumentSettings(); - } - - /** Returns the builder for the settings used for calls to listLocations. */ - public PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings() { - return getStubSettingsBuilder().listLocationsSettings(); - } - - /** Returns the builder for the settings used for calls to getLocation. */ - public UnaryCallSettings.Builder getLocationSettings() { - return getStubSettingsBuilder().getLocationSettings(); - } - - @Override - public DocumentUnderstandingServiceSettings build() throws IOException { - return new DocumentUnderstandingServiceSettings(this); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/gapic_metadata.json b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/gapic_metadata.json deleted file mode 100644 index 1f6cdb878067..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/gapic_metadata.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "java", - "protoPackage": "google.cloud.documentai.v1beta2", - "libraryPackage": "com.google.cloud.documentai.v1beta2", - "services": { - "DocumentUnderstandingService": { - "clients": { - "grpc": { - "libraryClient": "DocumentUnderstandingServiceClient", - "rpcs": { - "BatchProcessDocuments": { - "methods": ["batchProcessDocumentsAsync", "batchProcessDocumentsAsync", "batchProcessDocumentsOperationCallable", "batchProcessDocumentsCallable"] - }, - "GetLocation": { - "methods": ["getLocation", "getLocationCallable"] - }, - "ListLocations": { - "methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"] - }, - "ProcessDocument": { - "methods": ["processDocument", "processDocumentCallable"] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/package-info.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/package-info.java deleted file mode 100644 index b311f0422849..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/package-info.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * A client to Cloud Document AI API - * - *

The interfaces provided are listed below, along with usage samples. - * - *

======================= DocumentUnderstandingServiceClient ======================= - * - *

Service Description: Service to parse structured information from unstructured or - * semi-structured documents using state-of-the-art Google AI such as natural language, computer - * vision, and translation. - * - *

Sample for DocumentUnderstandingServiceClient: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
- *     DocumentUnderstandingServiceClient.create()) {
- *   ProcessDocumentRequest request =
- *       ProcessDocumentRequest.newBuilder()
- *           .setParent("parent-995424086")
- *           .setInputConfig(InputConfig.newBuilder().build())
- *           .setOutputConfig(OutputConfig.newBuilder().build())
- *           .setDocumentType("documentType-1473196299")
- *           .setTableExtractionParams(TableExtractionParams.newBuilder().build())
- *           .setFormExtractionParams(FormExtractionParams.newBuilder().build())
- *           .setEntityExtractionParams(EntityExtractionParams.newBuilder().build())
- *           .setOcrParams(OcrParams.newBuilder().build())
- *           .setAutomlParams(AutoMlParams.newBuilder().build())
- *           .build();
- *   Document response = documentUnderstandingServiceClient.processDocument(request);
- * }
- * }
- */ -@Generated("by gapic-generator-java") -package com.google.cloud.documentai.v1beta2; - -import javax.annotation.Generated; diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStub.java deleted file mode 100644 index 1db9b0e68bf9..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStub.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2.stub; - -import static com.google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient.ListLocationsPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; -import com.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; -import com.google.cloud.documentai.v1beta2.Document; -import com.google.cloud.documentai.v1beta2.OperationMetadata; -import com.google.cloud.documentai.v1beta2.ProcessDocumentRequest; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Base stub class for the DocumentUnderstandingService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public abstract class DocumentUnderstandingServiceStub implements BackgroundResource { - - public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); - } - - public OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable() { - throw new UnsupportedOperationException( - "Not implemented: batchProcessDocumentsOperationCallable()"); - } - - public UnaryCallable batchProcessDocumentsCallable() { - throw new UnsupportedOperationException("Not implemented: batchProcessDocumentsCallable()"); - } - - public UnaryCallable processDocumentCallable() { - throw new UnsupportedOperationException("Not implemented: processDocumentCallable()"); - } - - public UnaryCallable - listLocationsPagedCallable() { - throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()"); - } - - public UnaryCallable listLocationsCallable() { - throw new UnsupportedOperationException("Not implemented: listLocationsCallable()"); - } - - public UnaryCallable getLocationCallable() { - throw new UnsupportedOperationException("Not implemented: getLocationCallable()"); - } - - @Override - public abstract void close(); -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStubSettings.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStubSettings.java deleted file mode 100644 index b05c5a4ab104..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/DocumentUnderstandingServiceStubSettings.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2.stub; - -import static com.google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient.ListLocationsPagedResponse; - -import com.google.api.core.ApiFunction; -import com.google.api.core.ApiFuture; -import com.google.api.core.BetaApi; -import com.google.api.core.ObsoleteApi; -import com.google.api.gax.core.GaxProperties; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.GrpcTransportChannel; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.grpc.ProtoOperationTransformers; -import com.google.api.gax.longrunning.OperationSnapshot; -import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.rpc.ApiCallContext; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.PagedListDescriptor; -import com.google.api.gax.rpc.PagedListResponseFactory; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.StubSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; -import com.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; -import com.google.cloud.documentai.v1beta2.Document; -import com.google.cloud.documentai.v1beta2.OperationMetadata; -import com.google.cloud.documentai.v1beta2.ProcessDocumentRequest; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.longrunning.Operation; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; -import org.threeten.bp.Duration; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link DocumentUnderstandingServiceStub}. - * - *

The default instance has everything set to sensible defaults: - * - *

    - *
  • The default service address (documentai.googleapis.com) and default port (443) are used. - *
  • Credentials are acquired automatically through Application Default Credentials. - *
  • Retries are configured for idempotent methods but not for non-idempotent methods. - *
- * - *

The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *

For example, to set the - * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) - * of processDocument: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceStubSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceStubSettings.newBuilder();
- * documentUnderstandingServiceSettingsBuilder
- *     .processDocumentSettings()
- *     .setRetrySettings(
- *         documentUnderstandingServiceSettingsBuilder
- *             .processDocumentSettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
- *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
- *             .setMaxAttempts(5)
- *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
- *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
- *             .setRetryDelayMultiplier(1.3)
- *             .setRpcTimeoutMultiplier(1.5)
- *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
- *             .build());
- * DocumentUnderstandingServiceStubSettings documentUnderstandingServiceSettings =
- *     documentUnderstandingServiceSettingsBuilder.build();
- * }
- * - * Please refer to the [Client Side Retry - * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for - * additional support in setting retries. - * - *

To configure the RetrySettings of a Long Running Operation method, create an - * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to - * configure the RetrySettings for batchProcessDocuments: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - 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
- * DocumentUnderstandingServiceStubSettings.Builder documentUnderstandingServiceSettingsBuilder =
- *     DocumentUnderstandingServiceStubSettings.newBuilder();
- * TimedRetryAlgorithm timedRetryAlgorithm =
- *     OperationalTimedPollAlgorithm.create(
- *         RetrySettings.newBuilder()
- *             .setInitialRetryDelayDuration(Duration.ofMillis(500))
- *             .setRetryDelayMultiplier(1.5)
- *             .setMaxRetryDelay(Duration.ofMillis(5000))
- *             .setTotalTimeoutDuration(Duration.ofHours(24))
- *             .build());
- * documentUnderstandingServiceSettingsBuilder
- *     .createClusterOperationSettings()
- *     .setPollingAlgorithm(timedRetryAlgorithm)
- *     .build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceStubSettings - extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); - - private final UnaryCallSettings - batchProcessDocumentsSettings; - private final OperationCallSettings< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings; - private final UnaryCallSettings processDocumentSettings; - private final PagedCallSettings< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings; - private final UnaryCallSettings getLocationSettings; - - private static final PagedListDescriptor - LIST_LOCATIONS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListLocationsRequest injectToken(ListLocationsRequest payload, String token) { - return ListLocationsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListLocationsRequest injectPageSize(ListLocationsRequest payload, int pageSize) { - return ListLocationsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListLocationsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListLocationsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListLocationsResponse payload) { - return payload.getLocationsList(); - } - }; - - private static final PagedListResponseFactory< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - LIST_LOCATIONS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListLocationsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_LOCATIONS_PAGE_STR_DESC, request, context); - return ListLocationsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings - batchProcessDocumentsSettings() { - return batchProcessDocumentsSettings; - } - - /** Returns the object with the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return batchProcessDocumentsOperationSettings; - } - - /** Returns the object with the settings used for calls to processDocument. */ - public UnaryCallSettings processDocumentSettings() { - return processDocumentSettings; - } - - /** Returns the object with the settings used for calls to listLocations. */ - public PagedCallSettings - listLocationsSettings() { - return listLocationsSettings; - } - - /** Returns the object with the settings used for calls to getLocation. */ - public UnaryCallSettings getLocationSettings() { - return getLocationSettings; - } - - public DocumentUnderstandingServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcDocumentUnderstandingServiceStub.create(this); - } - throw new UnsupportedOperationException( - String.format( - "Transport not supported: %s", getTransportChannelProvider().getTransportName())); - } - - /** Returns the default service name. */ - @Override - public String getServiceName() { - return "documentai"; - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - @ObsoleteApi("Use getEndpoint() instead") - public static String getDefaultEndpoint() { - return "documentai.googleapis.com:443"; - } - - /** Returns the default mTLS service endpoint. */ - public static String getDefaultMtlsEndpoint() { - return "documentai.mtls.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder() - .setScopesToApply(DEFAULT_SERVICE_SCOPES) - .setUseJwtAccessWithScope(true); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", - GaxProperties.getLibraryVersion(DocumentUnderstandingServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected DocumentUnderstandingServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - batchProcessDocumentsSettings = settingsBuilder.batchProcessDocumentsSettings().build(); - batchProcessDocumentsOperationSettings = - settingsBuilder.batchProcessDocumentsOperationSettings().build(); - processDocumentSettings = settingsBuilder.processDocumentSettings().build(); - listLocationsSettings = settingsBuilder.listLocationsSettings().build(); - getLocationSettings = settingsBuilder.getLocationSettings().build(); - } - - /** Builder for DocumentUnderstandingServiceStubSettings. */ - public static class Builder - extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder - batchProcessDocumentsSettings; - private final OperationCallSettings.Builder< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings; - private final UnaryCallSettings.Builder - processDocumentSettings; - private final PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings; - private final UnaryCallSettings.Builder getLocationSettings; - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "retry_policy_0_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(120000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) - .setTotalTimeout(Duration.ofMillis(120000L)) - .build(); - definitions.put("retry_policy_0_params", settings); - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - batchProcessDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - batchProcessDocumentsOperationSettings = OperationCallSettings.newBuilder(); - processDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); - getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - batchProcessDocumentsSettings, - processDocumentSettings, - listLocationsSettings, - getLocationSettings); - initDefaults(this); - } - - protected Builder(DocumentUnderstandingServiceStubSettings settings) { - super(settings); - - batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder(); - batchProcessDocumentsOperationSettings = - settings.batchProcessDocumentsOperationSettings.toBuilder(); - processDocumentSettings = settings.processDocumentSettings.toBuilder(); - listLocationsSettings = settings.listLocationsSettings.toBuilder(); - getLocationSettings = settings.getLocationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - batchProcessDocumentsSettings, - processDocumentSettings, - listLocationsSettings, - getLocationSettings); - } - - private static Builder createDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - builder - .batchProcessDocumentsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .processDocumentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .listLocationsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - builder - .getLocationSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); - - builder - .batchProcessDocumentsOperationSettings() - .setInitialCallSettings( - UnaryCallSettings - .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")) - .build()) - .setResponseTransformer( - ProtoOperationTransformers.ResponseTransformer.create( - BatchProcessDocumentsResponse.class)) - .setMetadataTransformer( - ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) - .setPollingAlgorithm( - OperationTimedPollAlgorithm.create( - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(5000L)) - .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(45000L)) - .setInitialRpcTimeout(Duration.ZERO) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ZERO) - .setTotalTimeout(Duration.ofMillis(300000L)) - .build())); - - return builder; - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public UnaryCallSettings.Builder - batchProcessDocumentsSettings() { - return batchProcessDocumentsSettings; - } - - /** Returns the builder for the settings used for calls to batchProcessDocuments. */ - public OperationCallSettings.Builder< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationSettings() { - return batchProcessDocumentsOperationSettings; - } - - /** Returns the builder for the settings used for calls to processDocument. */ - public UnaryCallSettings.Builder processDocumentSettings() { - return processDocumentSettings; - } - - /** Returns the builder for the settings used for calls to listLocations. */ - public PagedCallSettings.Builder< - ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> - listLocationsSettings() { - return listLocationsSettings; - } - - /** Returns the builder for the settings used for calls to getLocation. */ - public UnaryCallSettings.Builder getLocationSettings() { - return getLocationSettings; - } - - @Override - public DocumentUnderstandingServiceStubSettings build() throws IOException { - return new DocumentUnderstandingServiceStubSettings(this); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceCallableFactory.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceCallableFactory.java deleted file mode 100644 index 5baee7777241..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceCallableFactory.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcCallableFactory; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC callable factory implementation for the DocumentUnderstandingService service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcDocumentUnderstandingServiceCallableFactory implements GrpcStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - GrpcCallSettings grpcCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - GrpcCallSettings grpcCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, callSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceStub.java b/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceStub.java deleted file mode 100644 index 0e0550747f31..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta2/stub/GrpcDocumentUnderstandingServiceStub.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2.stub; - -import static com.google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient.ListLocationsPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.grpc.GrpcCallSettings; -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.RequestParamsBuilder; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest; -import com.google.cloud.documentai.v1beta2.BatchProcessDocumentsResponse; -import com.google.cloud.documentai.v1beta2.Document; -import com.google.cloud.documentai.v1beta2.OperationMetadata; -import com.google.cloud.documentai.v1beta2.ProcessDocumentRequest; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.GrpcOperationsStub; -import io.grpc.MethodDescriptor; -import io.grpc.protobuf.ProtoUtils; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC stub implementation for the DocumentUnderstandingService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingServiceStub { - private static final MethodDescriptor - batchProcessDocumentsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.documentai.v1beta2.DocumentUnderstandingService/BatchProcessDocuments") - .setRequestMarshaller( - ProtoUtils.marshaller(BatchProcessDocumentsRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - processDocumentMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.documentai.v1beta2.DocumentUnderstandingService/ProcessDocument") - .setRequestMarshaller( - ProtoUtils.marshaller(ProcessDocumentRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Document.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - listLocationsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.location.Locations/ListLocations") - .setRequestMarshaller( - ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor getLocationMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.location.Locations/GetLocation") - .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) - .build(); - - private final UnaryCallable - batchProcessDocumentsCallable; - private final OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable; - private final UnaryCallable processDocumentCallable; - private final UnaryCallable listLocationsCallable; - private final UnaryCallable - listLocationsPagedCallable; - private final UnaryCallable getLocationCallable; - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final GrpcStubCallableFactory callableFactory; - - public static final GrpcDocumentUnderstandingServiceStub create( - DocumentUnderstandingServiceStubSettings settings) throws IOException { - return new GrpcDocumentUnderstandingServiceStub(settings, ClientContext.create(settings)); - } - - public static final GrpcDocumentUnderstandingServiceStub create(ClientContext clientContext) - throws IOException { - return new GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings.newBuilder().build(), clientContext); - } - - public static final GrpcDocumentUnderstandingServiceStub create( - ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { - return new GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings.newBuilder().build(), - clientContext, - callableFactory); - } - - /** - * Constructs an instance of GrpcDocumentUnderstandingServiceStub, using the given settings. This - * is protected so that it is easy to make a subclass, but otherwise, the static factory methods - * should be preferred. - */ - protected GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings settings, ClientContext clientContext) - throws IOException { - this(settings, clientContext, new GrpcDocumentUnderstandingServiceCallableFactory()); - } - - /** - * Constructs an instance of GrpcDocumentUnderstandingServiceStub, using the given settings. This - * is protected so that it is easy to make a subclass, but otherwise, the static factory methods - * should be preferred. - */ - protected GrpcDocumentUnderstandingServiceStub( - DocumentUnderstandingServiceStubSettings settings, - ClientContext clientContext, - GrpcStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - - GrpcCallSettings - batchProcessDocumentsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(batchProcessDocumentsMethodDescriptor) - .setParamsExtractor( - request -> { - RequestParamsBuilder builder = RequestParamsBuilder.create(); - builder.add("parent", String.valueOf(request.getParent())); - return builder.build(); - }) - .build(); - GrpcCallSettings processDocumentTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(processDocumentMethodDescriptor) - .setParamsExtractor( - request -> { - RequestParamsBuilder builder = RequestParamsBuilder.create(); - builder.add("parent", String.valueOf(request.getParent())); - return builder.build(); - }) - .build(); - GrpcCallSettings listLocationsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listLocationsMethodDescriptor) - .setParamsExtractor( - request -> { - RequestParamsBuilder builder = RequestParamsBuilder.create(); - builder.add("name", String.valueOf(request.getName())); - return builder.build(); - }) - .build(); - GrpcCallSettings getLocationTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getLocationMethodDescriptor) - .setParamsExtractor( - request -> { - RequestParamsBuilder builder = RequestParamsBuilder.create(); - builder.add("name", String.valueOf(request.getName())); - return builder.build(); - }) - .build(); - - this.batchProcessDocumentsCallable = - callableFactory.createUnaryCallable( - batchProcessDocumentsTransportSettings, - settings.batchProcessDocumentsSettings(), - clientContext); - this.batchProcessDocumentsOperationCallable = - callableFactory.createOperationCallable( - batchProcessDocumentsTransportSettings, - settings.batchProcessDocumentsOperationSettings(), - clientContext, - operationsStub); - this.processDocumentCallable = - callableFactory.createUnaryCallable( - processDocumentTransportSettings, settings.processDocumentSettings(), clientContext); - this.listLocationsCallable = - callableFactory.createUnaryCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.listLocationsPagedCallable = - callableFactory.createPagedCallable( - listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); - this.getLocationCallable = - callableFactory.createUnaryCallable( - getLocationTransportSettings, settings.getLocationSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - @Override - public UnaryCallable batchProcessDocumentsCallable() { - return batchProcessDocumentsCallable; - } - - @Override - public OperationCallable< - BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> - batchProcessDocumentsOperationCallable() { - return batchProcessDocumentsOperationCallable; - } - - @Override - public UnaryCallable processDocumentCallable() { - return processDocumentCallable; - } - - @Override - public UnaryCallable listLocationsCallable() { - return listLocationsCallable; - } - - @Override - public UnaryCallable - listLocationsPagedCallable() { - return listLocationsPagedCallable; - } - - @Override - public UnaryCallable getLocationCallable() { - return getLocationCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java deleted file mode 100644 index 8ce6d71570f0..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.testing.LocalChannelProvider; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.api.gax.grpc.testing.MockServiceHelper; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.longrunning.Operation; -import com.google.protobuf.AbstractMessage; -import com.google.protobuf.Any; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceClientTest { - private static MockDocumentUnderstandingService mockDocumentUnderstandingService; - private static MockServiceHelper mockServiceHelper; - private LocalChannelProvider channelProvider; - private DocumentUnderstandingServiceClient client; - - @BeforeClass - public static void startStaticServer() { - mockDocumentUnderstandingService = new MockDocumentUnderstandingService(); - mockServiceHelper = - new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList(mockDocumentUnderstandingService)); - mockServiceHelper.start(); - } - - @AfterClass - public static void stopServer() { - mockServiceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - mockServiceHelper.reset(); - channelProvider = mockServiceHelper.createChannelProvider(); - DocumentUnderstandingServiceSettings settings = - DocumentUnderstandingServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = DocumentUnderstandingServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - public void batchProcessDocumentsTest() throws Exception { - BatchProcessDocumentsResponse expectedResponse = - BatchProcessDocumentsResponse.newBuilder() - .addAllResponses(new ArrayList()) - .build(); - Operation resultOperation = - Operation.newBuilder() - .setName("batchProcessDocumentsTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockDocumentUnderstandingService.addResponse(resultOperation); - - List requests = new ArrayList<>(); - - BatchProcessDocumentsResponse actualResponse = - client.batchProcessDocumentsAsync(requests).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDocumentUnderstandingService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - BatchProcessDocumentsRequest actualRequest = - ((BatchProcessDocumentsRequest) actualRequests.get(0)); - - Assert.assertEquals(requests, actualRequest.getRequestsList()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void batchProcessDocumentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDocumentUnderstandingService.addException(exception); - - try { - List requests = new ArrayList<>(); - client.batchProcessDocumentsAsync(requests).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java deleted file mode 100644 index 8f0ae25ffd0e..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockDocumentUnderstandingService implements MockGrpcService { - private final MockDocumentUnderstandingServiceImpl serviceImpl; - - public MockDocumentUnderstandingService() { - serviceImpl = new MockDocumentUnderstandingServiceImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(AbstractMessage response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java deleted file mode 100644 index 8ef112e58f02..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta1; - -import com.google.api.core.BetaApi; -import com.google.cloud.documentai.v1beta1.DocumentUnderstandingServiceGrpc.DocumentUnderstandingServiceImplBase; -import com.google.longrunning.Operation; -import com.google.protobuf.AbstractMessage; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockDocumentUnderstandingServiceImpl extends DocumentUnderstandingServiceImplBase { - private List requests; - private Queue responses; - - public MockDocumentUnderstandingServiceImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(AbstractMessage response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void batchProcessDocuments( - BatchProcessDocumentsRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Operation) { - requests.add(request); - responseObserver.onNext(((Operation) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method BatchProcessDocuments, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Operation.class.getName(), - Exception.class.getName()))); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClientTest.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClientTest.java deleted file mode 100644 index 46c984630db7..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceClientTest.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2; - -import static com.google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClient.ListLocationsPagedResponse; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.grpc.GaxGrpcProperties; -import com.google.api.gax.grpc.testing.LocalChannelProvider; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.api.gax.grpc.testing.MockServiceHelper; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.common.collect.Lists; -import com.google.longrunning.Operation; -import com.google.protobuf.AbstractMessage; -import com.google.protobuf.Any; -import com.google.rpc.Status; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class DocumentUnderstandingServiceClientTest { - private static MockDocumentUnderstandingService mockDocumentUnderstandingService; - private static MockLocations mockLocations; - private static MockServiceHelper mockServiceHelper; - private LocalChannelProvider channelProvider; - private DocumentUnderstandingServiceClient client; - - @BeforeClass - public static void startStaticServer() { - mockDocumentUnderstandingService = new MockDocumentUnderstandingService(); - mockLocations = new MockLocations(); - mockServiceHelper = - new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList(mockDocumentUnderstandingService, mockLocations)); - mockServiceHelper.start(); - } - - @AfterClass - public static void stopServer() { - mockServiceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - mockServiceHelper.reset(); - channelProvider = mockServiceHelper.createChannelProvider(); - DocumentUnderstandingServiceSettings settings = - DocumentUnderstandingServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = DocumentUnderstandingServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - public void batchProcessDocumentsTest() throws Exception { - BatchProcessDocumentsResponse expectedResponse = - BatchProcessDocumentsResponse.newBuilder() - .addAllResponses(new ArrayList()) - .build(); - Operation resultOperation = - Operation.newBuilder() - .setName("batchProcessDocumentsTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockDocumentUnderstandingService.addResponse(resultOperation); - - List requests = new ArrayList<>(); - - BatchProcessDocumentsResponse actualResponse = - client.batchProcessDocumentsAsync(requests).get(); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDocumentUnderstandingService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - BatchProcessDocumentsRequest actualRequest = - ((BatchProcessDocumentsRequest) actualRequests.get(0)); - - Assert.assertEquals(requests, actualRequest.getRequestsList()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void batchProcessDocumentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDocumentUnderstandingService.addException(exception); - - try { - List requests = new ArrayList<>(); - client.batchProcessDocumentsAsync(requests).get(); - Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); - } - } - - @Test - public void processDocumentTest() throws Exception { - Document expectedResponse = - Document.newBuilder() - .setMimeType("mimeType-1392120434") - .setText("text3556653") - .addAllTextStyles(new ArrayList()) - .addAllPages(new ArrayList()) - .addAllEntities(new ArrayList()) - .addAllEntityRelations(new ArrayList()) - .addAllTextChanges(new ArrayList()) - .setShardInfo(Document.ShardInfo.newBuilder().build()) - .addAllLabels(new ArrayList()) - .setError(Status.newBuilder().build()) - .addAllRevisions(new ArrayList()) - .build(); - mockDocumentUnderstandingService.addResponse(expectedResponse); - - ProcessDocumentRequest request = - ProcessDocumentRequest.newBuilder() - .setParent("parent-995424086") - .setInputConfig(InputConfig.newBuilder().build()) - .setOutputConfig(OutputConfig.newBuilder().build()) - .setDocumentType("documentType-1473196299") - .setTableExtractionParams(TableExtractionParams.newBuilder().build()) - .setFormExtractionParams(FormExtractionParams.newBuilder().build()) - .setEntityExtractionParams(EntityExtractionParams.newBuilder().build()) - .setOcrParams(OcrParams.newBuilder().build()) - .setAutomlParams(AutoMlParams.newBuilder().build()) - .build(); - - Document actualResponse = client.processDocument(request); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDocumentUnderstandingService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ProcessDocumentRequest actualRequest = ((ProcessDocumentRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getParent(), actualRequest.getParent()); - Assert.assertEquals(request.getInputConfig(), actualRequest.getInputConfig()); - Assert.assertEquals(request.getOutputConfig(), actualRequest.getOutputConfig()); - Assert.assertEquals(request.getDocumentType(), actualRequest.getDocumentType()); - Assert.assertEquals( - request.getTableExtractionParams(), actualRequest.getTableExtractionParams()); - Assert.assertEquals(request.getFormExtractionParams(), actualRequest.getFormExtractionParams()); - Assert.assertEquals( - request.getEntityExtractionParams(), actualRequest.getEntityExtractionParams()); - Assert.assertEquals(request.getOcrParams(), actualRequest.getOcrParams()); - Assert.assertEquals(request.getAutomlParams(), actualRequest.getAutomlParams()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void processDocumentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDocumentUnderstandingService.addException(exception); - - try { - ProcessDocumentRequest request = - ProcessDocumentRequest.newBuilder() - .setParent("parent-995424086") - .setInputConfig(InputConfig.newBuilder().build()) - .setOutputConfig(OutputConfig.newBuilder().build()) - .setDocumentType("documentType-1473196299") - .setTableExtractionParams(TableExtractionParams.newBuilder().build()) - .setFormExtractionParams(FormExtractionParams.newBuilder().build()) - .setEntityExtractionParams(EntityExtractionParams.newBuilder().build()) - .setOcrParams(OcrParams.newBuilder().build()) - .setAutomlParams(AutoMlParams.newBuilder().build()) - .build(); - client.processDocument(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listLocationsTest() throws Exception { - Location responsesElement = Location.newBuilder().build(); - ListLocationsResponse expectedResponse = - ListLocationsResponse.newBuilder() - .setNextPageToken("") - .addAllLocations(Arrays.asList(responsesElement)) - .build(); - mockLocations.addResponse(expectedResponse); - - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("name3373707") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - - ListLocationsPagedResponse pagedListResponse = client.listLocations(request); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getLocationsList().get(0), resources.get(0)); - - List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListLocationsRequest actualRequest = ((ListLocationsRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertEquals(request.getFilter(), actualRequest.getFilter()); - Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); - Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listLocationsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLocations.addException(exception); - - try { - ListLocationsRequest request = - ListLocationsRequest.newBuilder() - .setName("name3373707") - .setFilter("filter-1274492040") - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - client.listLocations(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getLocationTest() throws Exception { - Location expectedResponse = - Location.newBuilder() - .setName("name3373707") - .setLocationId("locationId1541836720") - .setDisplayName("displayName1714148973") - .putAllLabels(new HashMap()) - .setMetadata(Any.newBuilder().build()) - .build(); - mockLocations.addResponse(expectedResponse); - - GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); - - Location actualResponse = client.getLocation(request); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLocations.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetLocationRequest actualRequest = ((GetLocationRequest) actualRequests.get(0)); - - Assert.assertEquals(request.getName(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getLocationExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLocations.addException(exception); - - try { - GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); - client.getLocation(request); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockDocumentUnderstandingService.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockDocumentUnderstandingService.java deleted file mode 100644 index 0414598432d4..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockDocumentUnderstandingService.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockDocumentUnderstandingService implements MockGrpcService { - private final MockDocumentUnderstandingServiceImpl serviceImpl; - - public MockDocumentUnderstandingService() { - serviceImpl = new MockDocumentUnderstandingServiceImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(AbstractMessage response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockDocumentUnderstandingServiceImpl.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockDocumentUnderstandingServiceImpl.java deleted file mode 100644 index c4bab580a210..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockDocumentUnderstandingServiceImpl.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.cloud.documentai.v1beta2.DocumentUnderstandingServiceGrpc.DocumentUnderstandingServiceImplBase; -import com.google.longrunning.Operation; -import com.google.protobuf.AbstractMessage; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockDocumentUnderstandingServiceImpl extends DocumentUnderstandingServiceImplBase { - private List requests; - private Queue responses; - - public MockDocumentUnderstandingServiceImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(AbstractMessage response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void batchProcessDocuments( - BatchProcessDocumentsRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Operation) { - requests.add(request); - responseObserver.onNext(((Operation) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method BatchProcessDocuments, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Operation.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void processDocument( - ProcessDocumentRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Document) { - requests.add(request); - responseObserver.onNext(((Document) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method ProcessDocument, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Document.class.getName(), - Exception.class.getName()))); - } - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockLocations.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockLocations.java deleted file mode 100644 index 36cff0a95456..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockLocations.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockLocations implements MockGrpcService { - private final MockLocationsImpl serviceImpl; - - public MockLocations() { - serviceImpl = new MockLocationsImpl(); - } - - @Override - public List getRequests() { - return serviceImpl.getRequests(); - } - - @Override - public void addResponse(AbstractMessage response) { - serviceImpl.addResponse(response); - } - - @Override - public void addException(Exception exception) { - serviceImpl.addException(exception); - } - - @Override - public ServerServiceDefinition getServiceDefinition() { - return serviceImpl.bindService(); - } - - @Override - public void reset() { - serviceImpl.reset(); - } -} diff --git a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockLocationsImpl.java b/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockLocationsImpl.java deleted file mode 100644 index f1a9f321bd00..000000000000 --- a/java-document-ai/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta2/MockLocationsImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.documentai.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.cloud.location.GetLocationRequest; -import com.google.cloud.location.ListLocationsRequest; -import com.google.cloud.location.ListLocationsResponse; -import com.google.cloud.location.Location; -import com.google.cloud.location.LocationsGrpc.LocationsImplBase; -import com.google.protobuf.AbstractMessage; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockLocationsImpl extends LocationsImplBase { - private List requests; - private Queue responses; - - public MockLocationsImpl() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - public List getRequests() { - return requests; - } - - public void addResponse(AbstractMessage response) { - responses.add(response); - } - - public void setResponses(List responses) { - this.responses = new LinkedList(responses); - } - - public void addException(Exception exception) { - responses.add(exception); - } - - public void reset() { - requests = new ArrayList<>(); - responses = new LinkedList<>(); - } - - @Override - public void listLocations( - ListLocationsRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof ListLocationsResponse) { - requests.add(request); - responseObserver.onNext(((ListLocationsResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method ListLocations, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - ListLocationsResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void getLocation(GetLocationRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Location) { - requests.add(request); - responseObserver.onNext(((Location) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method GetLocation, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Location.class.getName(), - Exception.class.getName()))); - } - } -} diff --git a/java-document-ai/grpc-google-cloud-document-ai-v1beta1/pom.xml b/java-document-ai/grpc-google-cloud-document-ai-v1beta1/pom.xml deleted file mode 100644 index 6e87981f8622..000000000000 --- a/java-document-ai/grpc-google-cloud-document-ai-v1beta1/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta1 - 0.68.0-SNAPSHOT - grpc-google-cloud-document-ai-v1beta1 - GRPC library for grpc-google-cloud-document-ai-v1beta1 - - com.google.cloud - google-cloud-document-ai-parent - 2.56.0-SNAPSHOT - - - - io.grpc - grpc-api - - - io.grpc - grpc-stub - - - io.grpc - grpc-protobuf - - - com.google.protobuf - protobuf-java - - - com.google.api.grpc - proto-google-common-protos - - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta1 - - - com.google.guava - guava - - - \ No newline at end of file diff --git a/java-document-ai/grpc-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceGrpc.java b/java-document-ai/grpc-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceGrpc.java deleted file mode 100644 index d08b30e06346..000000000000 --- a/java-document-ai/grpc-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceGrpc.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.cloud.documentai.v1beta1; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - * - * - *
- * Service to parse structured information from unstructured or semi-structured
- * documents using state-of-the-art Google AI such as natural language,
- * computer vision, and translation.
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/cloud/documentai/v1beta1/document_understanding.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class DocumentUnderstandingServiceGrpc { - - private DocumentUnderstandingServiceGrpc() {} - - public static final java.lang.String SERVICE_NAME = - "google.cloud.documentai.v1beta1.DocumentUnderstandingService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, - com.google.longrunning.Operation> - getBatchProcessDocumentsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "BatchProcessDocuments", - requestType = com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.class, - responseType = com.google.longrunning.Operation.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, - com.google.longrunning.Operation> - getBatchProcessDocumentsMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, - com.google.longrunning.Operation> - getBatchProcessDocumentsMethod; - if ((getBatchProcessDocumentsMethod = - DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod) - == null) { - synchronized (DocumentUnderstandingServiceGrpc.class) { - if ((getBatchProcessDocumentsMethod = - DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod) - == null) { - DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod = - getBatchProcessDocumentsMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "BatchProcessDocuments")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.longrunning.Operation.getDefaultInstance())) - .setSchemaDescriptor( - new DocumentUnderstandingServiceMethodDescriptorSupplier( - "BatchProcessDocuments")) - .build(); - } - } - } - return getBatchProcessDocumentsMethod; - } - - /** Creates a new async stub that supports all call types for the service */ - public static DocumentUnderstandingServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DocumentUnderstandingServiceStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceStub(channel, callOptions); - } - }; - return DocumentUnderstandingServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static DocumentUnderstandingServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DocumentUnderstandingServiceBlockingStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceBlockingStub(channel, callOptions); - } - }; - return DocumentUnderstandingServiceBlockingStub.newStub(factory, channel); - } - - /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static DocumentUnderstandingServiceFutureStub newFutureStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DocumentUnderstandingServiceFutureStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceFutureStub(channel, callOptions); - } - }; - return DocumentUnderstandingServiceFutureStub.newStub(factory, channel); - } - - /** - * - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public interface AsyncService { - - /** - * - * - *
-     * LRO endpoint to batch process many documents.
-     * 
- */ - default void batchProcessDocuments( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getBatchProcessDocumentsMethod(), responseObserver); - } - } - - /** - * Base class for the server implementation of the service DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public abstract static class DocumentUnderstandingServiceImplBase - implements io.grpc.BindableService, AsyncService { - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return DocumentUnderstandingServiceGrpc.bindService(this); - } - } - - /** - * A stub to allow clients to do asynchronous rpc calls to service DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public static final class DocumentUnderstandingServiceStub - extends io.grpc.stub.AbstractAsyncStub { - private DocumentUnderstandingServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DocumentUnderstandingServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceStub(channel, callOptions); - } - - /** - * - * - *
-     * LRO endpoint to batch process many documents.
-     * 
- */ - public void batchProcessDocuments( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getBatchProcessDocumentsMethod(), getCallOptions()), - request, - responseObserver); - } - } - - /** - * A stub to allow clients to do synchronous rpc calls to service DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public static final class DocumentUnderstandingServiceBlockingStub - extends io.grpc.stub.AbstractBlockingStub { - private DocumentUnderstandingServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DocumentUnderstandingServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceBlockingStub(channel, callOptions); - } - - /** - * - * - *
-     * LRO endpoint to batch process many documents.
-     * 
- */ - public com.google.longrunning.Operation batchProcessDocuments( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getBatchProcessDocumentsMethod(), getCallOptions(), request); - } - } - - /** - * A stub to allow clients to do ListenableFuture-style rpc calls to service - * DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public static final class DocumentUnderstandingServiceFutureStub - extends io.grpc.stub.AbstractFutureStub { - private DocumentUnderstandingServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DocumentUnderstandingServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceFutureStub(channel, callOptions); - } - - /** - * - * - *
-     * LRO endpoint to batch process many documents.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - batchProcessDocuments( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getBatchProcessDocumentsMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_BATCH_PROCESS_DOCUMENTS = 0; - - private static final class MethodHandlers - implements io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final AsyncService serviceImpl; - private final int methodId; - - MethodHandlers(AsyncService serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_BATCH_PROCESS_DOCUMENTS: - serviceImpl.batchProcessDocuments( - (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - } - - public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getBatchProcessDocumentsMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, - com.google.longrunning.Operation>(service, METHODID_BATCH_PROCESS_DOCUMENTS))) - .build(); - } - - private abstract static class DocumentUnderstandingServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, - io.grpc.protobuf.ProtoServiceDescriptorSupplier { - DocumentUnderstandingServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("DocumentUnderstandingService"); - } - } - - private static final class DocumentUnderstandingServiceFileDescriptorSupplier - extends DocumentUnderstandingServiceBaseDescriptorSupplier { - DocumentUnderstandingServiceFileDescriptorSupplier() {} - } - - private static final class DocumentUnderstandingServiceMethodDescriptorSupplier - extends DocumentUnderstandingServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final java.lang.String methodName; - - DocumentUnderstandingServiceMethodDescriptorSupplier(java.lang.String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (DocumentUnderstandingServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = - result = - io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new DocumentUnderstandingServiceFileDescriptorSupplier()) - .addMethod(getBatchProcessDocumentsMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/java-document-ai/grpc-google-cloud-document-ai-v1beta2/pom.xml b/java-document-ai/grpc-google-cloud-document-ai-v1beta2/pom.xml deleted file mode 100644 index a76b0b08f8d6..000000000000 --- a/java-document-ai/grpc-google-cloud-document-ai-v1beta2/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta2 - 0.68.0-SNAPSHOT - grpc-google-cloud-document-ai-v1beta2 - GRPC library for grpc-google-cloud-document-ai-v1beta2 - - com.google.cloud - google-cloud-document-ai-parent - 2.56.0-SNAPSHOT - - - - io.grpc - grpc-api - - - io.grpc - grpc-stub - - - io.grpc - grpc-protobuf - - - com.google.protobuf - protobuf-java - - - com.google.api.grpc - proto-google-common-protos - - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta2 - - - com.google.guava - guava - - - \ No newline at end of file diff --git a/java-document-ai/grpc-google-cloud-document-ai-v1beta2/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceGrpc.java b/java-document-ai/grpc-google-cloud-document-ai-v1beta2/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceGrpc.java deleted file mode 100644 index 89297ffd45a4..000000000000 --- a/java-document-ai/grpc-google-cloud-document-ai-v1beta2/src/main/java/com/google/cloud/documentai/v1beta2/DocumentUnderstandingServiceGrpc.java +++ /dev/null @@ -1,524 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.cloud.documentai.v1beta2; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - * - * - *
- * Service to parse structured information from unstructured or semi-structured
- * documents using state-of-the-art Google AI such as natural language,
- * computer vision, and translation.
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/cloud/documentai/v1beta2/document_understanding.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class DocumentUnderstandingServiceGrpc { - - private DocumentUnderstandingServiceGrpc() {} - - public static final java.lang.String SERVICE_NAME = - "google.cloud.documentai.v1beta2.DocumentUnderstandingService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest, - com.google.longrunning.Operation> - getBatchProcessDocumentsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "BatchProcessDocuments", - requestType = com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest.class, - responseType = com.google.longrunning.Operation.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest, - com.google.longrunning.Operation> - getBatchProcessDocumentsMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest, - com.google.longrunning.Operation> - getBatchProcessDocumentsMethod; - if ((getBatchProcessDocumentsMethod = - DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod) - == null) { - synchronized (DocumentUnderstandingServiceGrpc.class) { - if ((getBatchProcessDocumentsMethod = - DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod) - == null) { - DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod = - getBatchProcessDocumentsMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "BatchProcessDocuments")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.longrunning.Operation.getDefaultInstance())) - .setSchemaDescriptor( - new DocumentUnderstandingServiceMethodDescriptorSupplier( - "BatchProcessDocuments")) - .build(); - } - } - } - return getBatchProcessDocumentsMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest, - com.google.cloud.documentai.v1beta2.Document> - getProcessDocumentMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ProcessDocument", - requestType = com.google.cloud.documentai.v1beta2.ProcessDocumentRequest.class, - responseType = com.google.cloud.documentai.v1beta2.Document.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest, - com.google.cloud.documentai.v1beta2.Document> - getProcessDocumentMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest, - com.google.cloud.documentai.v1beta2.Document> - getProcessDocumentMethod; - if ((getProcessDocumentMethod = DocumentUnderstandingServiceGrpc.getProcessDocumentMethod) - == null) { - synchronized (DocumentUnderstandingServiceGrpc.class) { - if ((getProcessDocumentMethod = DocumentUnderstandingServiceGrpc.getProcessDocumentMethod) - == null) { - DocumentUnderstandingServiceGrpc.getProcessDocumentMethod = - getProcessDocumentMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ProcessDocument")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.documentai.v1beta2.Document.getDefaultInstance())) - .setSchemaDescriptor( - new DocumentUnderstandingServiceMethodDescriptorSupplier( - "ProcessDocument")) - .build(); - } - } - } - return getProcessDocumentMethod; - } - - /** Creates a new async stub that supports all call types for the service */ - public static DocumentUnderstandingServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DocumentUnderstandingServiceStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceStub(channel, callOptions); - } - }; - return DocumentUnderstandingServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static DocumentUnderstandingServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DocumentUnderstandingServiceBlockingStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceBlockingStub(channel, callOptions); - } - }; - return DocumentUnderstandingServiceBlockingStub.newStub(factory, channel); - } - - /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static DocumentUnderstandingServiceFutureStub newFutureStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DocumentUnderstandingServiceFutureStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceFutureStub(channel, callOptions); - } - }; - return DocumentUnderstandingServiceFutureStub.newStub(factory, channel); - } - - /** - * - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public interface AsyncService { - - /** - * - * - *
-     * LRO endpoint to batch process many documents. The output is written
-     * to Cloud Storage as JSON in the [Document] format.
-     * 
- */ - default void batchProcessDocuments( - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getBatchProcessDocumentsMethod(), responseObserver); - } - - /** - * - * - *
-     * Processes a single document.
-     * 
- */ - default void processDocument( - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getProcessDocumentMethod(), responseObserver); - } - } - - /** - * Base class for the server implementation of the service DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public abstract static class DocumentUnderstandingServiceImplBase - implements io.grpc.BindableService, AsyncService { - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return DocumentUnderstandingServiceGrpc.bindService(this); - } - } - - /** - * A stub to allow clients to do asynchronous rpc calls to service DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public static final class DocumentUnderstandingServiceStub - extends io.grpc.stub.AbstractAsyncStub { - private DocumentUnderstandingServiceStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DocumentUnderstandingServiceStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceStub(channel, callOptions); - } - - /** - * - * - *
-     * LRO endpoint to batch process many documents. The output is written
-     * to Cloud Storage as JSON in the [Document] format.
-     * 
- */ - public void batchProcessDocuments( - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getBatchProcessDocumentsMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Processes a single document.
-     * 
- */ - public void processDocument( - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getProcessDocumentMethod(), getCallOptions()), - request, - responseObserver); - } - } - - /** - * A stub to allow clients to do synchronous rpc calls to service DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public static final class DocumentUnderstandingServiceBlockingStub - extends io.grpc.stub.AbstractBlockingStub { - private DocumentUnderstandingServiceBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DocumentUnderstandingServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceBlockingStub(channel, callOptions); - } - - /** - * - * - *
-     * LRO endpoint to batch process many documents. The output is written
-     * to Cloud Storage as JSON in the [Document] format.
-     * 
- */ - public com.google.longrunning.Operation batchProcessDocuments( - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getBatchProcessDocumentsMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Processes a single document.
-     * 
- */ - public com.google.cloud.documentai.v1beta2.Document processDocument( - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getProcessDocumentMethod(), getCallOptions(), request); - } - } - - /** - * A stub to allow clients to do ListenableFuture-style rpc calls to service - * DocumentUnderstandingService. - * - *
-   * Service to parse structured information from unstructured or semi-structured
-   * documents using state-of-the-art Google AI such as natural language,
-   * computer vision, and translation.
-   * 
- */ - public static final class DocumentUnderstandingServiceFutureStub - extends io.grpc.stub.AbstractFutureStub { - private DocumentUnderstandingServiceFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DocumentUnderstandingServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DocumentUnderstandingServiceFutureStub(channel, callOptions); - } - - /** - * - * - *
-     * LRO endpoint to batch process many documents. The output is written
-     * to Cloud Storage as JSON in the [Document] format.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - batchProcessDocuments( - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getBatchProcessDocumentsMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Processes a single document.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.documentai.v1beta2.Document> - processDocument(com.google.cloud.documentai.v1beta2.ProcessDocumentRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getProcessDocumentMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_BATCH_PROCESS_DOCUMENTS = 0; - private static final int METHODID_PROCESS_DOCUMENT = 1; - - private static final class MethodHandlers - implements io.grpc.stub.ServerCalls.UnaryMethod, - io.grpc.stub.ServerCalls.ServerStreamingMethod, - io.grpc.stub.ServerCalls.ClientStreamingMethod, - io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final AsyncService serviceImpl; - private final int methodId; - - MethodHandlers(AsyncService serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_BATCH_PROCESS_DOCUMENTS: - serviceImpl.batchProcessDocuments( - (com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_PROCESS_DOCUMENT: - serviceImpl.processDocument( - (com.google.cloud.documentai.v1beta2.ProcessDocumentRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - default: - throw new AssertionError(); - } - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public io.grpc.stub.StreamObserver invoke( - io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - default: - throw new AssertionError(); - } - } - } - - public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getBatchProcessDocumentsMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.documentai.v1beta2.BatchProcessDocumentsRequest, - com.google.longrunning.Operation>(service, METHODID_BATCH_PROCESS_DOCUMENTS))) - .addMethod( - getProcessDocumentMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.documentai.v1beta2.ProcessDocumentRequest, - com.google.cloud.documentai.v1beta2.Document>( - service, METHODID_PROCESS_DOCUMENT))) - .build(); - } - - private abstract static class DocumentUnderstandingServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, - io.grpc.protobuf.ProtoServiceDescriptorSupplier { - DocumentUnderstandingServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.google.cloud.documentai.v1beta2.DocumentAiProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("DocumentUnderstandingService"); - } - } - - private static final class DocumentUnderstandingServiceFileDescriptorSupplier - extends DocumentUnderstandingServiceBaseDescriptorSupplier { - DocumentUnderstandingServiceFileDescriptorSupplier() {} - } - - private static final class DocumentUnderstandingServiceMethodDescriptorSupplier - extends DocumentUnderstandingServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final java.lang.String methodName; - - DocumentUnderstandingServiceMethodDescriptorSupplier(java.lang.String methodName) { - this.methodName = methodName; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { - return getServiceDescriptor().findMethodByName(methodName); - } - } - - private static volatile io.grpc.ServiceDescriptor serviceDescriptor; - - public static io.grpc.ServiceDescriptor getServiceDescriptor() { - io.grpc.ServiceDescriptor result = serviceDescriptor; - if (result == null) { - synchronized (DocumentUnderstandingServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = - result = - io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new DocumentUnderstandingServiceFileDescriptorSupplier()) - .addMethod(getBatchProcessDocumentsMethod()) - .addMethod(getProcessDocumentMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/java-document-ai/pom.xml b/java-document-ai/pom.xml index 252bb1aba389..35774f13d7b0 100644 --- a/java-document-ai/pom.xml +++ b/java-document-ai/pom.xml @@ -26,11 +26,6 @@ - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta1 - 0.68.0-SNAPSHOT - com.google.api.grpc proto-google-cloud-document-ai-v1 @@ -46,26 +41,11 @@ google-cloud-document-ai 2.56.0-SNAPSHOT - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta2 - 0.68.0-SNAPSHOT - com.google.api.grpc grpc-google-cloud-document-ai-v1beta3 0.68.0-SNAPSHOT - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta1 - 0.68.0-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta2 - 0.68.0-SNAPSHOT - com.google.api.grpc proto-google-cloud-document-ai-v1beta3 @@ -76,12 +56,8 @@ google-cloud-document-ai - grpc-google-cloud-document-ai-v1beta1 - grpc-google-cloud-document-ai-v1beta2 grpc-google-cloud-document-ai-v1beta3 grpc-google-cloud-document-ai-v1 - proto-google-cloud-document-ai-v1beta1 - proto-google-cloud-document-ai-v1beta2 proto-google-cloud-document-ai-v1beta3 proto-google-cloud-document-ai-v1 google-cloud-document-ai-bom diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/clirr-ignored-differences.xml b/java-document-ai/proto-google-cloud-document-ai-v1beta1/clirr-ignored-differences.xml deleted file mode 100644 index 46aadea41427..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/clirr-ignored-differences.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - 7012 - com/google/cloud/documentai/v1beta1/*OrBuilder - * get*(*) - - - 7012 - com/google/cloud/documentai/v1beta1/*OrBuilder - boolean contains*(*) - - - 7012 - com/google/cloud/documentai/v1beta1/*OrBuilder - boolean has*(*) - - - - 7006 - com/google/cloud/documentai/v1beta1/** - * getDefaultInstanceForType() - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * addRepeatedField(*) - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * clear() - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * clearField(*) - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * clearOneof(*) - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * clone() - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * mergeUnknownFields(*) - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * setField(*) - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * setRepeatedField(*) - ** - - - 7006 - com/google/cloud/documentai/v1beta1/** - * setUnknownFields(*) - ** - - diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/pom.xml b/java-document-ai/proto-google-cloud-document-ai-v1beta1/pom.xml deleted file mode 100644 index e4b9c7d09ff8..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - com.google.api.grpc - proto-google-cloud-document-ai-v1beta1 - 0.68.0-SNAPSHOT - proto-google-cloud-document-ai-v1beta1 - PROTO library for proto-google-cloud-document-ai-v1beta1 - - com.google.cloud - google-cloud-document-ai-parent - 2.56.0-SNAPSHOT - - - - com.google.protobuf - protobuf-java - - - com.google.api.grpc - proto-google-common-protos - - - \ No newline at end of file diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequest.java b/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequest.java deleted file mode 100644 index e3d1a2226e3a..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequest.java +++ /dev/null @@ -1,1220 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/documentai/v1beta1/document_understanding.proto - -// Protobuf Java Version: 3.25.4 -package com.google.cloud.documentai.v1beta1; - -/** - * - * - *
- * Request to batch process documents as an asynchronous operation.
- * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} - */ -public final class BatchProcessDocumentsRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) - BatchProcessDocumentsRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use BatchProcessDocumentsRequest.newBuilder() to construct. - private BatchProcessDocumentsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private BatchProcessDocumentsRequest() { - requests_ = java.util.Collections.emptyList(); - parent_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new BatchProcessDocumentsRequest(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.class, - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.Builder.class); - } - - public static final int REQUESTS_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private java.util.List requests_; - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public java.util.List - getRequestsList() { - return requests_; - } - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public java.util.List< - ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> - getRequestsOrBuilderList() { - return requests_; - } - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public int getRequestsCount() { - return requests_.size(); - } - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest getRequests(int index) { - return requests_.get(index); - } - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder getRequestsOrBuilder( - int index) { - return requests_.get(index); - } - - public static final int PARENT_FIELD_NUMBER = 2; - - @SuppressWarnings("serial") - private volatile java.lang.Object parent_ = ""; - /** - * - * - *
-   * Target project and location to make a call.
-   *
-   * Format: `projects/{project-id}/locations/{location-id}`.
-   *
-   * If no location is specified, a region will be chosen automatically.
-   * 
- * - * string parent = 2; - * - * @return The parent. - */ - @java.lang.Override - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } - } - /** - * - * - *
-   * Target project and location to make a call.
-   *
-   * Format: `projects/{project-id}/locations/{location-id}`.
-   *
-   * If no location is specified, a region will be chosen automatically.
-   * 
- * - * string parent = 2; - * - * @return The bytes for parent. - */ - @java.lang.Override - public com.google.protobuf.ByteString getParentBytes() { - java.lang.Object ref = parent_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - parent_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < requests_.size(); i++) { - output.writeMessage(1, requests_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, parent_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < requests_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, requests_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, parent_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest)) { - return super.equals(obj); - } - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest other = - (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) obj; - - if (!getRequestsList().equals(other.getRequestsList())) return false; - if (!getParent().equals(other.getParent())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getRequestsCount() > 0) { - hash = (37 * hash) + REQUESTS_FIELD_NUMBER; - hash = (53 * hash) + getRequestsList().hashCode(); - } - hash = (37 * hash) + PARENT_FIELD_NUMBER; - hash = (53 * hash) + getParent().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request to batch process documents as an asynchronous operation.
-   * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.class, - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.Builder.class); - } - - // Construct using com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - if (requestsBuilder_ == null) { - requests_ = java.util.Collections.emptyList(); - } else { - requests_ = null; - requestsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - parent_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest - getDefaultInstanceForType() { - return com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest build() { - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest buildPartial() { - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest result = - new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(this); - buildPartialRepeatedFields(result); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartialRepeatedFields( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest result) { - if (requestsBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - requests_ = java.util.Collections.unmodifiableList(requests_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.requests_ = requests_; - } else { - result.requests_ = requestsBuilder_.build(); - } - } - - private void buildPartial0( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000002) != 0)) { - result.parent_ = parent_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) { - return mergeFrom((com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest other) { - if (other - == com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.getDefaultInstance()) - return this; - if (requestsBuilder_ == null) { - if (!other.requests_.isEmpty()) { - if (requests_.isEmpty()) { - requests_ = other.requests_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureRequestsIsMutable(); - requests_.addAll(other.requests_); - } - onChanged(); - } - } else { - if (!other.requests_.isEmpty()) { - if (requestsBuilder_.isEmpty()) { - requestsBuilder_.dispose(); - requestsBuilder_ = null; - requests_ = other.requests_; - bitField0_ = (bitField0_ & ~0x00000001); - requestsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getRequestsFieldBuilder() - : null; - } else { - requestsBuilder_.addAllMessages(other.requests_); - } - } - } - if (!other.getParent().isEmpty()) { - parent_ = other.parent_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest m = - input.readMessage( - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.parser(), - extensionRegistry); - if (requestsBuilder_ == null) { - ensureRequestsIsMutable(); - requests_.add(m); - } else { - requestsBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - parent_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List requests_ = - java.util.Collections.emptyList(); - - private void ensureRequestsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - requests_ = - new java.util.ArrayList( - requests_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> - requestsBuilder_; - - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public java.util.List - getRequestsList() { - if (requestsBuilder_ == null) { - return java.util.Collections.unmodifiableList(requests_); - } else { - return requestsBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public int getRequestsCount() { - if (requestsBuilder_ == null) { - return requests_.size(); - } else { - return requestsBuilder_.getCount(); - } - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest getRequests(int index) { - if (requestsBuilder_ == null) { - return requests_.get(index); - } else { - return requestsBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setRequests( - int index, com.google.cloud.documentai.v1beta1.ProcessDocumentRequest value) { - if (requestsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRequestsIsMutable(); - requests_.set(index, value); - onChanged(); - } else { - requestsBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setRequests( - int index, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder builderForValue) { - if (requestsBuilder_ == null) { - ensureRequestsIsMutable(); - requests_.set(index, builderForValue.build()); - onChanged(); - } else { - requestsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder addRequests(com.google.cloud.documentai.v1beta1.ProcessDocumentRequest value) { - if (requestsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRequestsIsMutable(); - requests_.add(value); - onChanged(); - } else { - requestsBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder addRequests( - int index, com.google.cloud.documentai.v1beta1.ProcessDocumentRequest value) { - if (requestsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureRequestsIsMutable(); - requests_.add(index, value); - onChanged(); - } else { - requestsBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder addRequests( - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder builderForValue) { - if (requestsBuilder_ == null) { - ensureRequestsIsMutable(); - requests_.add(builderForValue.build()); - onChanged(); - } else { - requestsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder addRequests( - int index, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder builderForValue) { - if (requestsBuilder_ == null) { - ensureRequestsIsMutable(); - requests_.add(index, builderForValue.build()); - onChanged(); - } else { - requestsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder addAllRequests( - java.lang.Iterable - values) { - if (requestsBuilder_ == null) { - ensureRequestsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, requests_); - onChanged(); - } else { - requestsBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearRequests() { - if (requestsBuilder_ == null) { - requests_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - requestsBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder removeRequests(int index) { - if (requestsBuilder_ == null) { - ensureRequestsIsMutable(); - requests_.remove(index); - onChanged(); - } else { - requestsBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder getRequestsBuilder( - int index) { - return getRequestsFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder getRequestsOrBuilder( - int index) { - if (requestsBuilder_ == null) { - return requests_.get(index); - } else { - return requestsBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public java.util.List< - ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> - getRequestsOrBuilderList() { - if (requestsBuilder_ != null) { - return requestsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(requests_); - } - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder addRequestsBuilder() { - return getRequestsFieldBuilder() - .addBuilder( - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.getDefaultInstance()); - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder addRequestsBuilder( - int index) { - return getRequestsFieldBuilder() - .addBuilder( - index, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.getDefaultInstance()); - } - /** - * - * - *
-     * Required. Individual requests for each document.
-     * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public java.util.List - getRequestsBuilderList() { - return getRequestsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> - getRequestsFieldBuilder() { - if (requestsBuilder_ == null) { - requestsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder, - com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder>( - requests_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - requests_ = null; - } - return requestsBuilder_; - } - - private java.lang.Object parent_ = ""; - /** - * - * - *
-     * Target project and location to make a call.
-     *
-     * Format: `projects/{project-id}/locations/{location-id}`.
-     *
-     * If no location is specified, a region will be chosen automatically.
-     * 
- * - * string parent = 2; - * - * @return The parent. - */ - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Target project and location to make a call.
-     *
-     * Format: `projects/{project-id}/locations/{location-id}`.
-     *
-     * If no location is specified, a region will be chosen automatically.
-     * 
- * - * string parent = 2; - * - * @return The bytes for parent. - */ - public com.google.protobuf.ByteString getParentBytes() { - java.lang.Object ref = parent_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - parent_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Target project and location to make a call.
-     *
-     * Format: `projects/{project-id}/locations/{location-id}`.
-     *
-     * If no location is specified, a region will be chosen automatically.
-     * 
- * - * string parent = 2; - * - * @param value The parent to set. - * @return This builder for chaining. - */ - public Builder setParent(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - parent_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * - * - *
-     * Target project and location to make a call.
-     *
-     * Format: `projects/{project-id}/locations/{location-id}`.
-     *
-     * If no location is specified, a region will be chosen automatically.
-     * 
- * - * string parent = 2; - * - * @return This builder for chaining. - */ - public Builder clearParent() { - parent_ = getDefaultInstance().getParent(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - /** - * - * - *
-     * Target project and location to make a call.
-     *
-     * Format: `projects/{project-id}/locations/{location-id}`.
-     *
-     * If no location is specified, a region will be chosen automatically.
-     * 
- * - * string parent = 2; - * - * @param value The bytes for parent to set. - * @return This builder for chaining. - */ - public Builder setParentBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - parent_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) - private static final com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public BatchProcessDocumentsRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequestOrBuilder.java b/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequestOrBuilder.java deleted file mode 100644 index 9d45d9374e50..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequestOrBuilder.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/documentai/v1beta1/document_understanding.proto - -// Protobuf Java Version: 3.25.4 -package com.google.cloud.documentai.v1beta1; - -public interface BatchProcessDocumentsRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - java.util.List getRequestsList(); - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.documentai.v1beta1.ProcessDocumentRequest getRequests(int index); - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - int getRequestsCount(); - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - java.util.List - getRequestsOrBuilderList(); - /** - * - * - *
-   * Required. Individual requests for each document.
-   * 
- * - * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder getRequestsOrBuilder( - int index); - - /** - * - * - *
-   * Target project and location to make a call.
-   *
-   * Format: `projects/{project-id}/locations/{location-id}`.
-   *
-   * If no location is specified, a region will be chosen automatically.
-   * 
- * - * string parent = 2; - * - * @return The parent. - */ - java.lang.String getParent(); - /** - * - * - *
-   * Target project and location to make a call.
-   *
-   * Format: `projects/{project-id}/locations/{location-id}`.
-   *
-   * If no location is specified, a region will be chosen automatically.
-   * 
- * - * string parent = 2; - * - * @return The bytes for parent. - */ - com.google.protobuf.ByteString getParentBytes(); -} diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponse.java b/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponse.java deleted file mode 100644 index 20a36e5ca609..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponse.java +++ /dev/null @@ -1,969 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/documentai/v1beta1/document_understanding.proto - -// Protobuf Java Version: 3.25.4 -package com.google.cloud.documentai.v1beta1; - -/** - * - * - *
- * Response to an batch document processing request. This is returned in
- * the LRO Operation after the operation is complete.
- * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} - */ -public final class BatchProcessDocumentsResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) - BatchProcessDocumentsResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use BatchProcessDocumentsResponse.newBuilder() to construct. - private BatchProcessDocumentsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private BatchProcessDocumentsResponse() { - responses_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new BatchProcessDocumentsResponse(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.class, - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.Builder.class); - } - - public static final int RESPONSES_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private java.util.List responses_; - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - @java.lang.Override - public java.util.List - getResponsesList() { - return responses_; - } - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - @java.lang.Override - public java.util.List< - ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> - getResponsesOrBuilderList() { - return responses_; - } - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - @java.lang.Override - public int getResponsesCount() { - return responses_.size(); - } - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse getResponses(int index) { - return responses_.get(index); - } - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder getResponsesOrBuilder( - int index) { - return responses_.get(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < responses_.size(); i++) { - output.writeMessage(1, responses_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < responses_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, responses_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse)) { - return super.equals(obj); - } - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse other = - (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) obj; - - if (!getResponsesList().equals(other.getResponsesList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getResponsesCount() > 0) { - hash = (37 * hash) + RESPONSES_FIELD_NUMBER; - hash = (53 * hash) + getResponsesList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse - parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response to an batch document processing request. This is returned in
-   * the LRO Operation after the operation is complete.
-   * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.class, - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.Builder.class); - } - - // Construct using - // com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - if (responsesBuilder_ == null) { - responses_ = java.util.Collections.emptyList(); - } else { - responses_ = null; - responsesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.documentai.v1beta1.DocumentAiProto - .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse - getDefaultInstanceForType() { - return com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse build() { - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse buildPartial() { - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse result = - new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(this); - buildPartialRepeatedFields(result); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartialRepeatedFields( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse result) { - if (responsesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - responses_ = java.util.Collections.unmodifiableList(responses_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.responses_ = responses_; - } else { - result.responses_ = responsesBuilder_.build(); - } - } - - private void buildPartial0( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse result) { - int from_bitField0_ = bitField0_; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) { - return mergeFrom((com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse other) { - if (other - == com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.getDefaultInstance()) - return this; - if (responsesBuilder_ == null) { - if (!other.responses_.isEmpty()) { - if (responses_.isEmpty()) { - responses_ = other.responses_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureResponsesIsMutable(); - responses_.addAll(other.responses_); - } - onChanged(); - } - } else { - if (!other.responses_.isEmpty()) { - if (responsesBuilder_.isEmpty()) { - responsesBuilder_.dispose(); - responsesBuilder_ = null; - responses_ = other.responses_; - bitField0_ = (bitField0_ & ~0x00000001); - responsesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getResponsesFieldBuilder() - : null; - } else { - responsesBuilder_.addAllMessages(other.responses_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse m = - input.readMessage( - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.parser(), - extensionRegistry); - if (responsesBuilder_ == null) { - ensureResponsesIsMutable(); - responses_.add(m); - } else { - responsesBuilder_.addMessage(m); - } - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List responses_ = - java.util.Collections.emptyList(); - - private void ensureResponsesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - responses_ = - new java.util.ArrayList( - responses_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> - responsesBuilder_; - - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public java.util.List - getResponsesList() { - if (responsesBuilder_ == null) { - return java.util.Collections.unmodifiableList(responses_); - } else { - return responsesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public int getResponsesCount() { - if (responsesBuilder_ == null) { - return responses_.size(); - } else { - return responsesBuilder_.getCount(); - } - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse getResponses(int index) { - if (responsesBuilder_ == null) { - return responses_.get(index); - } else { - return responsesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder setResponses( - int index, com.google.cloud.documentai.v1beta1.ProcessDocumentResponse value) { - if (responsesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureResponsesIsMutable(); - responses_.set(index, value); - onChanged(); - } else { - responsesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder setResponses( - int index, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder builderForValue) { - if (responsesBuilder_ == null) { - ensureResponsesIsMutable(); - responses_.set(index, builderForValue.build()); - onChanged(); - } else { - responsesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder addResponses(com.google.cloud.documentai.v1beta1.ProcessDocumentResponse value) { - if (responsesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureResponsesIsMutable(); - responses_.add(value); - onChanged(); - } else { - responsesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder addResponses( - int index, com.google.cloud.documentai.v1beta1.ProcessDocumentResponse value) { - if (responsesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureResponsesIsMutable(); - responses_.add(index, value); - onChanged(); - } else { - responsesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder addResponses( - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder builderForValue) { - if (responsesBuilder_ == null) { - ensureResponsesIsMutable(); - responses_.add(builderForValue.build()); - onChanged(); - } else { - responsesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder addResponses( - int index, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder builderForValue) { - if (responsesBuilder_ == null) { - ensureResponsesIsMutable(); - responses_.add(index, builderForValue.build()); - onChanged(); - } else { - responsesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder addAllResponses( - java.lang.Iterable - values) { - if (responsesBuilder_ == null) { - ensureResponsesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, responses_); - onChanged(); - } else { - responsesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder clearResponses() { - if (responsesBuilder_ == null) { - responses_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - responsesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public Builder removeResponses(int index) { - if (responsesBuilder_ == null) { - ensureResponsesIsMutable(); - responses_.remove(index); - onChanged(); - } else { - responsesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder getResponsesBuilder( - int index) { - return getResponsesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder - getResponsesOrBuilder(int index) { - if (responsesBuilder_ == null) { - return responses_.get(index); - } else { - return responsesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public java.util.List< - ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> - getResponsesOrBuilderList() { - if (responsesBuilder_ != null) { - return responsesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(responses_); - } - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder - addResponsesBuilder() { - return getResponsesFieldBuilder() - .addBuilder( - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.getDefaultInstance()); - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder addResponsesBuilder( - int index) { - return getResponsesFieldBuilder() - .addBuilder( - index, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.getDefaultInstance()); - } - /** - * - * - *
-     * Responses for each individual document.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - public java.util.List - getResponsesBuilderList() { - return getResponsesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> - getResponsesFieldBuilder() { - if (responsesBuilder_ == null) { - responsesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder, - com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder>( - responses_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - responses_ = null; - } - return responsesBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) - private static final com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); - } - - public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public BatchProcessDocumentsResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponseOrBuilder.java b/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponseOrBuilder.java deleted file mode 100644 index 105a418c37a8..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponseOrBuilder.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/documentai/v1beta1/document_understanding.proto - -// Protobuf Java Version: 3.25.4 -package com.google.cloud.documentai.v1beta1; - -public interface BatchProcessDocumentsResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - java.util.List getResponsesList(); - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - com.google.cloud.documentai.v1beta1.ProcessDocumentResponse getResponses(int index); - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - int getResponsesCount(); - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - java.util.List - getResponsesOrBuilderList(); - /** - * - * - *
-   * Responses for each individual document.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; - */ - com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder getResponsesOrBuilder( - int index); -} diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPoly.java b/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPoly.java deleted file mode 100644 index 86fd90262f6b..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPoly.java +++ /dev/null @@ -1,1466 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/documentai/v1beta1/geometry.proto - -// Protobuf Java Version: 3.25.4 -package com.google.cloud.documentai.v1beta1; - -/** - * - * - *
- * A bounding polygon for the detected image annotation.
- * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.BoundingPoly} - */ -public final class BoundingPoly extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.BoundingPoly) - BoundingPolyOrBuilder { - private static final long serialVersionUID = 0L; - // Use BoundingPoly.newBuilder() to construct. - private BoundingPoly(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private BoundingPoly() { - vertices_ = java.util.Collections.emptyList(); - normalizedVertices_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new BoundingPoly(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.GeometryProto - .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.GeometryProto - .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.BoundingPoly.class, - com.google.cloud.documentai.v1beta1.BoundingPoly.Builder.class); - } - - public static final int VERTICES_FIELD_NUMBER = 1; - - @SuppressWarnings("serial") - private java.util.List vertices_; - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - @java.lang.Override - public java.util.List getVerticesList() { - return vertices_; - } - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - @java.lang.Override - public java.util.List - getVerticesOrBuilderList() { - return vertices_; - } - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - @java.lang.Override - public int getVerticesCount() { - return vertices_.size(); - } - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Vertex getVertices(int index) { - return vertices_.get(index); - } - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.VertexOrBuilder getVerticesOrBuilder(int index) { - return vertices_.get(index); - } - - public static final int NORMALIZED_VERTICES_FIELD_NUMBER = 2; - - @SuppressWarnings("serial") - private java.util.List normalizedVertices_; - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - @java.lang.Override - public java.util.List - getNormalizedVerticesList() { - return normalizedVertices_; - } - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - @java.lang.Override - public java.util.List - getNormalizedVerticesOrBuilderList() { - return normalizedVertices_; - } - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - @java.lang.Override - public int getNormalizedVerticesCount() { - return normalizedVertices_.size(); - } - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.NormalizedVertex getNormalizedVertices(int index) { - return normalizedVertices_.get(index); - } - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder - getNormalizedVerticesOrBuilder(int index) { - return normalizedVertices_.get(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < vertices_.size(); i++) { - output.writeMessage(1, vertices_.get(i)); - } - for (int i = 0; i < normalizedVertices_.size(); i++) { - output.writeMessage(2, normalizedVertices_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < vertices_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, vertices_.get(i)); - } - for (int i = 0; i < normalizedVertices_.size(); i++) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize(2, normalizedVertices_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.documentai.v1beta1.BoundingPoly)) { - return super.equals(obj); - } - com.google.cloud.documentai.v1beta1.BoundingPoly other = - (com.google.cloud.documentai.v1beta1.BoundingPoly) obj; - - if (!getVerticesList().equals(other.getVerticesList())) return false; - if (!getNormalizedVerticesList().equals(other.getNormalizedVerticesList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getVerticesCount() > 0) { - hash = (37 * hash) + VERTICES_FIELD_NUMBER; - hash = (53 * hash) + getVerticesList().hashCode(); - } - if (getNormalizedVerticesCount() > 0) { - hash = (37 * hash) + NORMALIZED_VERTICES_FIELD_NUMBER; - hash = (53 * hash) + getNormalizedVerticesList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(com.google.cloud.documentai.v1beta1.BoundingPoly prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * A bounding polygon for the detected image annotation.
-   * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.BoundingPoly} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.BoundingPoly) - com.google.cloud.documentai.v1beta1.BoundingPolyOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.GeometryProto - .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.GeometryProto - .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.BoundingPoly.class, - com.google.cloud.documentai.v1beta1.BoundingPoly.Builder.class); - } - - // Construct using com.google.cloud.documentai.v1beta1.BoundingPoly.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - if (verticesBuilder_ == null) { - vertices_ = java.util.Collections.emptyList(); - } else { - vertices_ = null; - verticesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (normalizedVerticesBuilder_ == null) { - normalizedVertices_ = java.util.Collections.emptyList(); - } else { - normalizedVertices_ = null; - normalizedVerticesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.documentai.v1beta1.GeometryProto - .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_descriptor; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BoundingPoly getDefaultInstanceForType() { - return com.google.cloud.documentai.v1beta1.BoundingPoly.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BoundingPoly build() { - com.google.cloud.documentai.v1beta1.BoundingPoly result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BoundingPoly buildPartial() { - com.google.cloud.documentai.v1beta1.BoundingPoly result = - new com.google.cloud.documentai.v1beta1.BoundingPoly(this); - buildPartialRepeatedFields(result); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartialRepeatedFields( - com.google.cloud.documentai.v1beta1.BoundingPoly result) { - if (verticesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - vertices_ = java.util.Collections.unmodifiableList(vertices_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.vertices_ = vertices_; - } else { - result.vertices_ = verticesBuilder_.build(); - } - if (normalizedVerticesBuilder_ == null) { - if (((bitField0_ & 0x00000002) != 0)) { - normalizedVertices_ = java.util.Collections.unmodifiableList(normalizedVertices_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.normalizedVertices_ = normalizedVertices_; - } else { - result.normalizedVertices_ = normalizedVerticesBuilder_.build(); - } - } - - private void buildPartial0(com.google.cloud.documentai.v1beta1.BoundingPoly result) { - int from_bitField0_ = bitField0_; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.documentai.v1beta1.BoundingPoly) { - return mergeFrom((com.google.cloud.documentai.v1beta1.BoundingPoly) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.documentai.v1beta1.BoundingPoly other) { - if (other == com.google.cloud.documentai.v1beta1.BoundingPoly.getDefaultInstance()) - return this; - if (verticesBuilder_ == null) { - if (!other.vertices_.isEmpty()) { - if (vertices_.isEmpty()) { - vertices_ = other.vertices_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureVerticesIsMutable(); - vertices_.addAll(other.vertices_); - } - onChanged(); - } - } else { - if (!other.vertices_.isEmpty()) { - if (verticesBuilder_.isEmpty()) { - verticesBuilder_.dispose(); - verticesBuilder_ = null; - vertices_ = other.vertices_; - bitField0_ = (bitField0_ & ~0x00000001); - verticesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getVerticesFieldBuilder() - : null; - } else { - verticesBuilder_.addAllMessages(other.vertices_); - } - } - } - if (normalizedVerticesBuilder_ == null) { - if (!other.normalizedVertices_.isEmpty()) { - if (normalizedVertices_.isEmpty()) { - normalizedVertices_ = other.normalizedVertices_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.addAll(other.normalizedVertices_); - } - onChanged(); - } - } else { - if (!other.normalizedVertices_.isEmpty()) { - if (normalizedVerticesBuilder_.isEmpty()) { - normalizedVerticesBuilder_.dispose(); - normalizedVerticesBuilder_ = null; - normalizedVertices_ = other.normalizedVertices_; - bitField0_ = (bitField0_ & ~0x00000002); - normalizedVerticesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getNormalizedVerticesFieldBuilder() - : null; - } else { - normalizedVerticesBuilder_.addAllMessages(other.normalizedVertices_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.documentai.v1beta1.Vertex m = - input.readMessage( - com.google.cloud.documentai.v1beta1.Vertex.parser(), extensionRegistry); - if (verticesBuilder_ == null) { - ensureVerticesIsMutable(); - vertices_.add(m); - } else { - verticesBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - com.google.cloud.documentai.v1beta1.NormalizedVertex m = - input.readMessage( - com.google.cloud.documentai.v1beta1.NormalizedVertex.parser(), - extensionRegistry); - if (normalizedVerticesBuilder_ == null) { - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.add(m); - } else { - normalizedVerticesBuilder_.addMessage(m); - } - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List vertices_ = - java.util.Collections.emptyList(); - - private void ensureVerticesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - vertices_ = new java.util.ArrayList(vertices_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Vertex, - com.google.cloud.documentai.v1beta1.Vertex.Builder, - com.google.cloud.documentai.v1beta1.VertexOrBuilder> - verticesBuilder_; - - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public java.util.List getVerticesList() { - if (verticesBuilder_ == null) { - return java.util.Collections.unmodifiableList(vertices_); - } else { - return verticesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public int getVerticesCount() { - if (verticesBuilder_ == null) { - return vertices_.size(); - } else { - return verticesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public com.google.cloud.documentai.v1beta1.Vertex getVertices(int index) { - if (verticesBuilder_ == null) { - return vertices_.get(index); - } else { - return verticesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder setVertices(int index, com.google.cloud.documentai.v1beta1.Vertex value) { - if (verticesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureVerticesIsMutable(); - vertices_.set(index, value); - onChanged(); - } else { - verticesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder setVertices( - int index, com.google.cloud.documentai.v1beta1.Vertex.Builder builderForValue) { - if (verticesBuilder_ == null) { - ensureVerticesIsMutable(); - vertices_.set(index, builderForValue.build()); - onChanged(); - } else { - verticesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder addVertices(com.google.cloud.documentai.v1beta1.Vertex value) { - if (verticesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureVerticesIsMutable(); - vertices_.add(value); - onChanged(); - } else { - verticesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder addVertices(int index, com.google.cloud.documentai.v1beta1.Vertex value) { - if (verticesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureVerticesIsMutable(); - vertices_.add(index, value); - onChanged(); - } else { - verticesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder addVertices(com.google.cloud.documentai.v1beta1.Vertex.Builder builderForValue) { - if (verticesBuilder_ == null) { - ensureVerticesIsMutable(); - vertices_.add(builderForValue.build()); - onChanged(); - } else { - verticesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder addVertices( - int index, com.google.cloud.documentai.v1beta1.Vertex.Builder builderForValue) { - if (verticesBuilder_ == null) { - ensureVerticesIsMutable(); - vertices_.add(index, builderForValue.build()); - onChanged(); - } else { - verticesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder addAllVertices( - java.lang.Iterable values) { - if (verticesBuilder_ == null) { - ensureVerticesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, vertices_); - onChanged(); - } else { - verticesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder clearVertices() { - if (verticesBuilder_ == null) { - vertices_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - verticesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public Builder removeVertices(int index) { - if (verticesBuilder_ == null) { - ensureVerticesIsMutable(); - vertices_.remove(index); - onChanged(); - } else { - verticesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public com.google.cloud.documentai.v1beta1.Vertex.Builder getVerticesBuilder(int index) { - return getVerticesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public com.google.cloud.documentai.v1beta1.VertexOrBuilder getVerticesOrBuilder(int index) { - if (verticesBuilder_ == null) { - return vertices_.get(index); - } else { - return verticesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public java.util.List - getVerticesOrBuilderList() { - if (verticesBuilder_ != null) { - return verticesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(vertices_); - } - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public com.google.cloud.documentai.v1beta1.Vertex.Builder addVerticesBuilder() { - return getVerticesFieldBuilder() - .addBuilder(com.google.cloud.documentai.v1beta1.Vertex.getDefaultInstance()); - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public com.google.cloud.documentai.v1beta1.Vertex.Builder addVerticesBuilder(int index) { - return getVerticesFieldBuilder() - .addBuilder(index, com.google.cloud.documentai.v1beta1.Vertex.getDefaultInstance()); - } - /** - * - * - *
-     * The bounding polygon vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - public java.util.List - getVerticesBuilderList() { - return getVerticesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Vertex, - com.google.cloud.documentai.v1beta1.Vertex.Builder, - com.google.cloud.documentai.v1beta1.VertexOrBuilder> - getVerticesFieldBuilder() { - if (verticesBuilder_ == null) { - verticesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Vertex, - com.google.cloud.documentai.v1beta1.Vertex.Builder, - com.google.cloud.documentai.v1beta1.VertexOrBuilder>( - vertices_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - vertices_ = null; - } - return verticesBuilder_; - } - - private java.util.List - normalizedVertices_ = java.util.Collections.emptyList(); - - private void ensureNormalizedVerticesIsMutable() { - if (!((bitField0_ & 0x00000002) != 0)) { - normalizedVertices_ = - new java.util.ArrayList( - normalizedVertices_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.NormalizedVertex, - com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder, - com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder> - normalizedVerticesBuilder_; - - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public java.util.List - getNormalizedVerticesList() { - if (normalizedVerticesBuilder_ == null) { - return java.util.Collections.unmodifiableList(normalizedVertices_); - } else { - return normalizedVerticesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public int getNormalizedVerticesCount() { - if (normalizedVerticesBuilder_ == null) { - return normalizedVertices_.size(); - } else { - return normalizedVerticesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public com.google.cloud.documentai.v1beta1.NormalizedVertex getNormalizedVertices(int index) { - if (normalizedVerticesBuilder_ == null) { - return normalizedVertices_.get(index); - } else { - return normalizedVerticesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder setNormalizedVertices( - int index, com.google.cloud.documentai.v1beta1.NormalizedVertex value) { - if (normalizedVerticesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.set(index, value); - onChanged(); - } else { - normalizedVerticesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder setNormalizedVertices( - int index, com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder builderForValue) { - if (normalizedVerticesBuilder_ == null) { - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.set(index, builderForValue.build()); - onChanged(); - } else { - normalizedVerticesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder addNormalizedVertices( - com.google.cloud.documentai.v1beta1.NormalizedVertex value) { - if (normalizedVerticesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.add(value); - onChanged(); - } else { - normalizedVerticesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder addNormalizedVertices( - int index, com.google.cloud.documentai.v1beta1.NormalizedVertex value) { - if (normalizedVerticesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.add(index, value); - onChanged(); - } else { - normalizedVerticesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder addNormalizedVertices( - com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder builderForValue) { - if (normalizedVerticesBuilder_ == null) { - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.add(builderForValue.build()); - onChanged(); - } else { - normalizedVerticesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder addNormalizedVertices( - int index, com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder builderForValue) { - if (normalizedVerticesBuilder_ == null) { - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.add(index, builderForValue.build()); - onChanged(); - } else { - normalizedVerticesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder addAllNormalizedVertices( - java.lang.Iterable values) { - if (normalizedVerticesBuilder_ == null) { - ensureNormalizedVerticesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, normalizedVertices_); - onChanged(); - } else { - normalizedVerticesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder clearNormalizedVertices() { - if (normalizedVerticesBuilder_ == null) { - normalizedVertices_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - normalizedVerticesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public Builder removeNormalizedVertices(int index) { - if (normalizedVerticesBuilder_ == null) { - ensureNormalizedVerticesIsMutable(); - normalizedVertices_.remove(index); - onChanged(); - } else { - normalizedVerticesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder - getNormalizedVerticesBuilder(int index) { - return getNormalizedVerticesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder - getNormalizedVerticesOrBuilder(int index) { - if (normalizedVerticesBuilder_ == null) { - return normalizedVertices_.get(index); - } else { - return normalizedVerticesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public java.util.List - getNormalizedVerticesOrBuilderList() { - if (normalizedVerticesBuilder_ != null) { - return normalizedVerticesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(normalizedVertices_); - } - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder - addNormalizedVerticesBuilder() { - return getNormalizedVerticesFieldBuilder() - .addBuilder(com.google.cloud.documentai.v1beta1.NormalizedVertex.getDefaultInstance()); - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder - addNormalizedVerticesBuilder(int index) { - return getNormalizedVerticesFieldBuilder() - .addBuilder( - index, com.google.cloud.documentai.v1beta1.NormalizedVertex.getDefaultInstance()); - } - /** - * - * - *
-     * The bounding polygon normalized vertices.
-     * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - public java.util.List - getNormalizedVerticesBuilderList() { - return getNormalizedVerticesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.NormalizedVertex, - com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder, - com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder> - getNormalizedVerticesFieldBuilder() { - if (normalizedVerticesBuilder_ == null) { - normalizedVerticesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.documentai.v1beta1.NormalizedVertex, - com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder, - com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder>( - normalizedVertices_, - ((bitField0_ & 0x00000002) != 0), - getParentForChildren(), - isClean()); - normalizedVertices_ = null; - } - return normalizedVerticesBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.BoundingPoly) - } - - // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.BoundingPoly) - private static final com.google.cloud.documentai.v1beta1.BoundingPoly DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.BoundingPoly(); - } - - public static com.google.cloud.documentai.v1beta1.BoundingPoly getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public BoundingPoly parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.BoundingPoly getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPolyOrBuilder.java b/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPolyOrBuilder.java deleted file mode 100644 index 027ccaa165f3..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPolyOrBuilder.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/documentai/v1beta1/geometry.proto - -// Protobuf Java Version: 3.25.4 -package com.google.cloud.documentai.v1beta1; - -public interface BoundingPolyOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.BoundingPoly) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - java.util.List getVerticesList(); - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - com.google.cloud.documentai.v1beta1.Vertex getVertices(int index); - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - int getVerticesCount(); - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - java.util.List - getVerticesOrBuilderList(); - /** - * - * - *
-   * The bounding polygon vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; - */ - com.google.cloud.documentai.v1beta1.VertexOrBuilder getVerticesOrBuilder(int index); - - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - java.util.List getNormalizedVerticesList(); - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - com.google.cloud.documentai.v1beta1.NormalizedVertex getNormalizedVertices(int index); - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - int getNormalizedVerticesCount(); - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - java.util.List - getNormalizedVerticesOrBuilderList(); - /** - * - * - *
-   * The bounding polygon normalized vertices.
-   * 
- * - * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; - * - */ - com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder getNormalizedVerticesOrBuilder( - int index); -} diff --git a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/Document.java b/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/Document.java deleted file mode 100644 index ec5f86f333c6..000000000000 --- a/java-document-ai/proto-google-cloud-document-ai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/Document.java +++ /dev/null @@ -1,37841 +0,0 @@ -/* - * Copyright 2024 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/documentai/v1beta1/document.proto - -// Protobuf Java Version: 3.25.4 -package com.google.cloud.documentai.v1beta1; - -/** - * - * - *
- * Document represents the canonical document resource in Document Understanding
- * AI.
- * It is an interchange format that provides insights into documents and allows
- * for collaboration between users and Document Understanding AI to iterate and
- * optimize for quality.
- * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.Document} - */ -public final class Document extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document) - DocumentOrBuilder { - private static final long serialVersionUID = 0L; - // Use Document.newBuilder() to construct. - private Document(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Document() { - mimeType_ = ""; - text_ = ""; - textStyles_ = java.util.Collections.emptyList(); - pages_ = java.util.Collections.emptyList(); - entities_ = java.util.Collections.emptyList(); - entityRelations_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Document(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.Document.class, - com.google.cloud.documentai.v1beta1.Document.Builder.class); - } - - public interface ShardInfoOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.Document.ShardInfo) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-     * The 0-based index of this shard.
-     * 
- * - * int64 shard_index = 1; - * - * @return The shardIndex. - */ - long getShardIndex(); - - /** - * - * - *
-     * Total number of shards.
-     * 
- * - * int64 shard_count = 2; - * - * @return The shardCount. - */ - long getShardCount(); - - /** - * - * - *
-     * The index of the first character in
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
-     * overall document global text.
-     * 
- * - * int64 text_offset = 3; - * - * @return The textOffset. - */ - long getTextOffset(); - } - /** - * - * - *
-   * For a large document, sharding may be performed to produce several
-   * document shards. Each document shard contains this field to detail which
-   * shard it is.
-   * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.Document.ShardInfo} - */ - public static final class ShardInfo extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document.ShardInfo) - ShardInfoOrBuilder { - private static final long serialVersionUID = 0L; - // Use ShardInfo.newBuilder() to construct. - private ShardInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ShardInfo() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ShardInfo(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.Document.ShardInfo.class, - com.google.cloud.documentai.v1beta1.Document.ShardInfo.Builder.class); - } - - public static final int SHARD_INDEX_FIELD_NUMBER = 1; - private long shardIndex_ = 0L; - /** - * - * - *
-     * The 0-based index of this shard.
-     * 
- * - * int64 shard_index = 1; - * - * @return The shardIndex. - */ - @java.lang.Override - public long getShardIndex() { - return shardIndex_; - } - - public static final int SHARD_COUNT_FIELD_NUMBER = 2; - private long shardCount_ = 0L; - /** - * - * - *
-     * Total number of shards.
-     * 
- * - * int64 shard_count = 2; - * - * @return The shardCount. - */ - @java.lang.Override - public long getShardCount() { - return shardCount_; - } - - public static final int TEXT_OFFSET_FIELD_NUMBER = 3; - private long textOffset_ = 0L; - /** - * - * - *
-     * The index of the first character in
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
-     * overall document global text.
-     * 
- * - * int64 text_offset = 3; - * - * @return The textOffset. - */ - @java.lang.Override - public long getTextOffset() { - return textOffset_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (shardIndex_ != 0L) { - output.writeInt64(1, shardIndex_); - } - if (shardCount_ != 0L) { - output.writeInt64(2, shardCount_); - } - if (textOffset_ != 0L) { - output.writeInt64(3, textOffset_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (shardIndex_ != 0L) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, shardIndex_); - } - if (shardCount_ != 0L) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, shardCount_); - } - if (textOffset_ != 0L) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(3, textOffset_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.documentai.v1beta1.Document.ShardInfo)) { - return super.equals(obj); - } - com.google.cloud.documentai.v1beta1.Document.ShardInfo other = - (com.google.cloud.documentai.v1beta1.Document.ShardInfo) obj; - - if (getShardIndex() != other.getShardIndex()) return false; - if (getShardCount() != other.getShardCount()) return false; - if (getTextOffset() != other.getTextOffset()) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + SHARD_INDEX_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getShardIndex()); - hash = (37 * hash) + SHARD_COUNT_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getShardCount()); - hash = (37 * hash) + TEXT_OFFSET_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getTextOffset()); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - com.google.cloud.documentai.v1beta1.Document.ShardInfo prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-     * For a large document, sharding may be performed to produce several
-     * document shards. Each document shard contains this field to detail which
-     * shard it is.
-     * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.Document.ShardInfo} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.Document.ShardInfo) - com.google.cloud.documentai.v1beta1.Document.ShardInfoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.Document.ShardInfo.class, - com.google.cloud.documentai.v1beta1.Document.ShardInfo.Builder.class); - } - - // Construct using com.google.cloud.documentai.v1beta1.Document.ShardInfo.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - shardIndex_ = 0L; - shardCount_ = 0L; - textOffset_ = 0L; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_descriptor; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.ShardInfo getDefaultInstanceForType() { - return com.google.cloud.documentai.v1beta1.Document.ShardInfo.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.ShardInfo build() { - com.google.cloud.documentai.v1beta1.Document.ShardInfo result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.ShardInfo buildPartial() { - com.google.cloud.documentai.v1beta1.Document.ShardInfo result = - new com.google.cloud.documentai.v1beta1.Document.ShardInfo(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0(com.google.cloud.documentai.v1beta1.Document.ShardInfo result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.shardIndex_ = shardIndex_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.shardCount_ = shardCount_; - } - if (((from_bitField0_ & 0x00000004) != 0)) { - result.textOffset_ = textOffset_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.documentai.v1beta1.Document.ShardInfo) { - return mergeFrom((com.google.cloud.documentai.v1beta1.Document.ShardInfo) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.documentai.v1beta1.Document.ShardInfo other) { - if (other == com.google.cloud.documentai.v1beta1.Document.ShardInfo.getDefaultInstance()) - return this; - if (other.getShardIndex() != 0L) { - setShardIndex(other.getShardIndex()); - } - if (other.getShardCount() != 0L) { - setShardCount(other.getShardCount()); - } - if (other.getTextOffset() != 0L) { - setTextOffset(other.getTextOffset()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - shardIndex_ = input.readInt64(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 16: - { - shardCount_ = input.readInt64(); - bitField0_ |= 0x00000002; - break; - } // case 16 - case 24: - { - textOffset_ = input.readInt64(); - bitField0_ |= 0x00000004; - break; - } // case 24 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private long shardIndex_; - /** - * - * - *
-       * The 0-based index of this shard.
-       * 
- * - * int64 shard_index = 1; - * - * @return The shardIndex. - */ - @java.lang.Override - public long getShardIndex() { - return shardIndex_; - } - /** - * - * - *
-       * The 0-based index of this shard.
-       * 
- * - * int64 shard_index = 1; - * - * @param value The shardIndex to set. - * @return This builder for chaining. - */ - public Builder setShardIndex(long value) { - - shardIndex_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * - * - *
-       * The 0-based index of this shard.
-       * 
- * - * int64 shard_index = 1; - * - * @return This builder for chaining. - */ - public Builder clearShardIndex() { - bitField0_ = (bitField0_ & ~0x00000001); - shardIndex_ = 0L; - onChanged(); - return this; - } - - private long shardCount_; - /** - * - * - *
-       * Total number of shards.
-       * 
- * - * int64 shard_count = 2; - * - * @return The shardCount. - */ - @java.lang.Override - public long getShardCount() { - return shardCount_; - } - /** - * - * - *
-       * Total number of shards.
-       * 
- * - * int64 shard_count = 2; - * - * @param value The shardCount to set. - * @return This builder for chaining. - */ - public Builder setShardCount(long value) { - - shardCount_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * - * - *
-       * Total number of shards.
-       * 
- * - * int64 shard_count = 2; - * - * @return This builder for chaining. - */ - public Builder clearShardCount() { - bitField0_ = (bitField0_ & ~0x00000002); - shardCount_ = 0L; - onChanged(); - return this; - } - - private long textOffset_; - /** - * - * - *
-       * The index of the first character in
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
-       * overall document global text.
-       * 
- * - * int64 text_offset = 3; - * - * @return The textOffset. - */ - @java.lang.Override - public long getTextOffset() { - return textOffset_; - } - /** - * - * - *
-       * The index of the first character in
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
-       * overall document global text.
-       * 
- * - * int64 text_offset = 3; - * - * @param value The textOffset to set. - * @return This builder for chaining. - */ - public Builder setTextOffset(long value) { - - textOffset_ = value; - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - /** - * - * - *
-       * The index of the first character in
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
-       * overall document global text.
-       * 
- * - * int64 text_offset = 3; - * - * @return This builder for chaining. - */ - public Builder clearTextOffset() { - bitField0_ = (bitField0_ & ~0x00000004); - textOffset_ = 0L; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.Document.ShardInfo) - } - - // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.Document.ShardInfo) - private static final com.google.cloud.documentai.v1beta1.Document.ShardInfo DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.Document.ShardInfo(); - } - - public static com.google.cloud.documentai.v1beta1.Document.ShardInfo getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ShardInfo parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.ShardInfo getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface StyleOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.Document.Style) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-     * Text anchor indexing into the
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - * - * @return Whether the textAnchor field is set. - */ - boolean hasTextAnchor(); - /** - * - * - *
-     * Text anchor indexing into the
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - * - * @return The textAnchor. - */ - com.google.cloud.documentai.v1beta1.Document.TextAnchor getTextAnchor(); - /** - * - * - *
-     * Text anchor indexing into the
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder getTextAnchorOrBuilder(); - - /** - * - * - *
-     * Text color.
-     * 
- * - * .google.type.Color color = 2; - * - * @return Whether the color field is set. - */ - boolean hasColor(); - /** - * - * - *
-     * Text color.
-     * 
- * - * .google.type.Color color = 2; - * - * @return The color. - */ - com.google.type.Color getColor(); - /** - * - * - *
-     * Text color.
-     * 
- * - * .google.type.Color color = 2; - */ - com.google.type.ColorOrBuilder getColorOrBuilder(); - - /** - * - * - *
-     * Text background color.
-     * 
- * - * .google.type.Color background_color = 3; - * - * @return Whether the backgroundColor field is set. - */ - boolean hasBackgroundColor(); - /** - * - * - *
-     * Text background color.
-     * 
- * - * .google.type.Color background_color = 3; - * - * @return The backgroundColor. - */ - com.google.type.Color getBackgroundColor(); - /** - * - * - *
-     * Text background color.
-     * 
- * - * .google.type.Color background_color = 3; - */ - com.google.type.ColorOrBuilder getBackgroundColorOrBuilder(); - - /** - * - * - *
-     * Font weight. Possible values are normal, bold, bolder, and lighter.
-     * https://www.w3schools.com/cssref/pr_font_weight.asp
-     * 
- * - * string font_weight = 4; - * - * @return The fontWeight. - */ - java.lang.String getFontWeight(); - /** - * - * - *
-     * Font weight. Possible values are normal, bold, bolder, and lighter.
-     * https://www.w3schools.com/cssref/pr_font_weight.asp
-     * 
- * - * string font_weight = 4; - * - * @return The bytes for fontWeight. - */ - com.google.protobuf.ByteString getFontWeightBytes(); - - /** - * - * - *
-     * Text style. Possible values are normal, italic, and oblique.
-     * https://www.w3schools.com/cssref/pr_font_font-style.asp
-     * 
- * - * string text_style = 5; - * - * @return The textStyle. - */ - java.lang.String getTextStyle(); - /** - * - * - *
-     * Text style. Possible values are normal, italic, and oblique.
-     * https://www.w3schools.com/cssref/pr_font_font-style.asp
-     * 
- * - * string text_style = 5; - * - * @return The bytes for textStyle. - */ - com.google.protobuf.ByteString getTextStyleBytes(); - - /** - * - * - *
-     * Text decoration. Follows CSS standard.
-     * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-     * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-     * 
- * - * string text_decoration = 6; - * - * @return The textDecoration. - */ - java.lang.String getTextDecoration(); - /** - * - * - *
-     * Text decoration. Follows CSS standard.
-     * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-     * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-     * 
- * - * string text_decoration = 6; - * - * @return The bytes for textDecoration. - */ - com.google.protobuf.ByteString getTextDecorationBytes(); - - /** - * - * - *
-     * Font size.
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - * - * @return Whether the fontSize field is set. - */ - boolean hasFontSize(); - /** - * - * - *
-     * Font size.
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - * - * @return The fontSize. - */ - com.google.cloud.documentai.v1beta1.Document.Style.FontSize getFontSize(); - /** - * - * - *
-     * Font size.
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder getFontSizeOrBuilder(); - } - /** - * - * - *
-   * Annotation for common text style attributes. This adheres to CSS
-   * conventions as much as possible.
-   * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style} - */ - public static final class Style extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document.Style) - StyleOrBuilder { - private static final long serialVersionUID = 0L; - // Use Style.newBuilder() to construct. - private Style(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Style() { - fontWeight_ = ""; - textStyle_ = ""; - textDecoration_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Style(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.Document.Style.class, - com.google.cloud.documentai.v1beta1.Document.Style.Builder.class); - } - - public interface FontSizeOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.Document.Style.FontSize) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-       * Font size for the text.
-       * 
- * - * float size = 1; - * - * @return The size. - */ - float getSize(); - - /** - * - * - *
-       * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-       * 
- * - * string unit = 2; - * - * @return The unit. - */ - java.lang.String getUnit(); - /** - * - * - *
-       * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-       * 
- * - * string unit = 2; - * - * @return The bytes for unit. - */ - com.google.protobuf.ByteString getUnitBytes(); - } - /** - * - * - *
-     * Font size with unit.
-     * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style.FontSize} - */ - public static final class FontSize extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document.Style.FontSize) - FontSizeOrBuilder { - private static final long serialVersionUID = 0L; - // Use FontSize.newBuilder() to construct. - private FontSize(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private FontSize() { - unit_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new FontSize(); - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.class, - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder.class); - } - - public static final int SIZE_FIELD_NUMBER = 1; - private float size_ = 0F; - /** - * - * - *
-       * Font size for the text.
-       * 
- * - * float size = 1; - * - * @return The size. - */ - @java.lang.Override - public float getSize() { - return size_; - } - - public static final int UNIT_FIELD_NUMBER = 2; - - @SuppressWarnings("serial") - private volatile java.lang.Object unit_ = ""; - /** - * - * - *
-       * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-       * 
- * - * string unit = 2; - * - * @return The unit. - */ - @java.lang.Override - public java.lang.String getUnit() { - java.lang.Object ref = unit_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - unit_ = s; - return s; - } - } - /** - * - * - *
-       * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-       * 
- * - * string unit = 2; - * - * @return The bytes for unit. - */ - @java.lang.Override - public com.google.protobuf.ByteString getUnitBytes() { - java.lang.Object ref = unit_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - unit_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (java.lang.Float.floatToRawIntBits(size_) != 0) { - output.writeFloat(1, size_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(unit_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, unit_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (java.lang.Float.floatToRawIntBits(size_) != 0) { - size += com.google.protobuf.CodedOutputStream.computeFloatSize(1, size_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(unit_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, unit_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.documentai.v1beta1.Document.Style.FontSize)) { - return super.equals(obj); - } - com.google.cloud.documentai.v1beta1.Document.Style.FontSize other = - (com.google.cloud.documentai.v1beta1.Document.Style.FontSize) obj; - - if (java.lang.Float.floatToIntBits(getSize()) - != java.lang.Float.floatToIntBits(other.getSize())) return false; - if (!getUnit().equals(other.getUnit())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + SIZE_FIELD_NUMBER; - hash = (53 * hash) + java.lang.Float.floatToIntBits(getSize()); - hash = (37 * hash) + UNIT_FIELD_NUMBER; - hash = (53 * hash) + getUnit().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-       * Font size with unit.
-       * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style.FontSize} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.Document.Style.FontSize) - com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.class, - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder.class); - } - - // Construct using com.google.cloud.documentai.v1beta1.Document.Style.FontSize.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - size_ = 0F; - unit_ = ""; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_descriptor; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style.FontSize - getDefaultInstanceForType() { - return com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style.FontSize build() { - com.google.cloud.documentai.v1beta1.Document.Style.FontSize result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style.FontSize buildPartial() { - com.google.cloud.documentai.v1beta1.Document.Style.FontSize result = - new com.google.cloud.documentai.v1beta1.Document.Style.FontSize(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize result) { - int from_bitField0_ = bitField0_; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.size_ = size_; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.unit_ = unit_; - } - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.documentai.v1beta1.Document.Style.FontSize) { - return mergeFrom((com.google.cloud.documentai.v1beta1.Document.Style.FontSize) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize other) { - if (other - == com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance()) - return this; - if (other.getSize() != 0F) { - setSize(other.getSize()); - } - if (!other.getUnit().isEmpty()) { - unit_ = other.unit_; - bitField0_ |= 0x00000002; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 13: - { - size_ = input.readFloat(); - bitField0_ |= 0x00000001; - break; - } // case 13 - case 18: - { - unit_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private float size_; - /** - * - * - *
-         * Font size for the text.
-         * 
- * - * float size = 1; - * - * @return The size. - */ - @java.lang.Override - public float getSize() { - return size_; - } - /** - * - * - *
-         * Font size for the text.
-         * 
- * - * float size = 1; - * - * @param value The size to set. - * @return This builder for chaining. - */ - public Builder setSize(float value) { - - size_ = value; - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * - * - *
-         * Font size for the text.
-         * 
- * - * float size = 1; - * - * @return This builder for chaining. - */ - public Builder clearSize() { - bitField0_ = (bitField0_ & ~0x00000001); - size_ = 0F; - onChanged(); - return this; - } - - private java.lang.Object unit_ = ""; - /** - * - * - *
-         * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-         * 
- * - * string unit = 2; - * - * @return The unit. - */ - public java.lang.String getUnit() { - java.lang.Object ref = unit_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - unit_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-         * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-         * 
- * - * string unit = 2; - * - * @return The bytes for unit. - */ - public com.google.protobuf.ByteString getUnitBytes() { - java.lang.Object ref = unit_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - unit_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-         * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-         * 
- * - * string unit = 2; - * - * @param value The unit to set. - * @return This builder for chaining. - */ - public Builder setUnit(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - unit_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * - * - *
-         * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-         * 
- * - * string unit = 2; - * - * @return This builder for chaining. - */ - public Builder clearUnit() { - unit_ = getDefaultInstance().getUnit(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - /** - * - * - *
-         * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
-         * 
- * - * string unit = 2; - * - * @param value The bytes for unit to set. - * @return This builder for chaining. - */ - public Builder setUnitBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - unit_ = value; - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.Document.Style.FontSize) - } - - // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.Document.Style.FontSize) - private static final com.google.cloud.documentai.v1beta1.Document.Style.FontSize - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.Document.Style.FontSize(); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public FontSize parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style.FontSize - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - private int bitField0_; - public static final int TEXT_ANCHOR_FIELD_NUMBER = 1; - private com.google.cloud.documentai.v1beta1.Document.TextAnchor textAnchor_; - /** - * - * - *
-     * Text anchor indexing into the
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - * - * @return Whether the textAnchor field is set. - */ - @java.lang.Override - public boolean hasTextAnchor() { - return ((bitField0_ & 0x00000001) != 0); - } - /** - * - * - *
-     * Text anchor indexing into the
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - * - * @return The textAnchor. - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.TextAnchor getTextAnchor() { - return textAnchor_ == null - ? com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance() - : textAnchor_; - } - /** - * - * - *
-     * Text anchor indexing into the
-     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder - getTextAnchorOrBuilder() { - return textAnchor_ == null - ? com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance() - : textAnchor_; - } - - public static final int COLOR_FIELD_NUMBER = 2; - private com.google.type.Color color_; - /** - * - * - *
-     * Text color.
-     * 
- * - * .google.type.Color color = 2; - * - * @return Whether the color field is set. - */ - @java.lang.Override - public boolean hasColor() { - return ((bitField0_ & 0x00000002) != 0); - } - /** - * - * - *
-     * Text color.
-     * 
- * - * .google.type.Color color = 2; - * - * @return The color. - */ - @java.lang.Override - public com.google.type.Color getColor() { - return color_ == null ? com.google.type.Color.getDefaultInstance() : color_; - } - /** - * - * - *
-     * Text color.
-     * 
- * - * .google.type.Color color = 2; - */ - @java.lang.Override - public com.google.type.ColorOrBuilder getColorOrBuilder() { - return color_ == null ? com.google.type.Color.getDefaultInstance() : color_; - } - - public static final int BACKGROUND_COLOR_FIELD_NUMBER = 3; - private com.google.type.Color backgroundColor_; - /** - * - * - *
-     * Text background color.
-     * 
- * - * .google.type.Color background_color = 3; - * - * @return Whether the backgroundColor field is set. - */ - @java.lang.Override - public boolean hasBackgroundColor() { - return ((bitField0_ & 0x00000004) != 0); - } - /** - * - * - *
-     * Text background color.
-     * 
- * - * .google.type.Color background_color = 3; - * - * @return The backgroundColor. - */ - @java.lang.Override - public com.google.type.Color getBackgroundColor() { - return backgroundColor_ == null - ? com.google.type.Color.getDefaultInstance() - : backgroundColor_; - } - /** - * - * - *
-     * Text background color.
-     * 
- * - * .google.type.Color background_color = 3; - */ - @java.lang.Override - public com.google.type.ColorOrBuilder getBackgroundColorOrBuilder() { - return backgroundColor_ == null - ? com.google.type.Color.getDefaultInstance() - : backgroundColor_; - } - - public static final int FONT_WEIGHT_FIELD_NUMBER = 4; - - @SuppressWarnings("serial") - private volatile java.lang.Object fontWeight_ = ""; - /** - * - * - *
-     * Font weight. Possible values are normal, bold, bolder, and lighter.
-     * https://www.w3schools.com/cssref/pr_font_weight.asp
-     * 
- * - * string font_weight = 4; - * - * @return The fontWeight. - */ - @java.lang.Override - public java.lang.String getFontWeight() { - java.lang.Object ref = fontWeight_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - fontWeight_ = s; - return s; - } - } - /** - * - * - *
-     * Font weight. Possible values are normal, bold, bolder, and lighter.
-     * https://www.w3schools.com/cssref/pr_font_weight.asp
-     * 
- * - * string font_weight = 4; - * - * @return The bytes for fontWeight. - */ - @java.lang.Override - public com.google.protobuf.ByteString getFontWeightBytes() { - java.lang.Object ref = fontWeight_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - fontWeight_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int TEXT_STYLE_FIELD_NUMBER = 5; - - @SuppressWarnings("serial") - private volatile java.lang.Object textStyle_ = ""; - /** - * - * - *
-     * Text style. Possible values are normal, italic, and oblique.
-     * https://www.w3schools.com/cssref/pr_font_font-style.asp
-     * 
- * - * string text_style = 5; - * - * @return The textStyle. - */ - @java.lang.Override - public java.lang.String getTextStyle() { - java.lang.Object ref = textStyle_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - textStyle_ = s; - return s; - } - } - /** - * - * - *
-     * Text style. Possible values are normal, italic, and oblique.
-     * https://www.w3schools.com/cssref/pr_font_font-style.asp
-     * 
- * - * string text_style = 5; - * - * @return The bytes for textStyle. - */ - @java.lang.Override - public com.google.protobuf.ByteString getTextStyleBytes() { - java.lang.Object ref = textStyle_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - textStyle_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int TEXT_DECORATION_FIELD_NUMBER = 6; - - @SuppressWarnings("serial") - private volatile java.lang.Object textDecoration_ = ""; - /** - * - * - *
-     * Text decoration. Follows CSS standard.
-     * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-     * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-     * 
- * - * string text_decoration = 6; - * - * @return The textDecoration. - */ - @java.lang.Override - public java.lang.String getTextDecoration() { - java.lang.Object ref = textDecoration_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - textDecoration_ = s; - return s; - } - } - /** - * - * - *
-     * Text decoration. Follows CSS standard.
-     * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-     * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-     * 
- * - * string text_decoration = 6; - * - * @return The bytes for textDecoration. - */ - @java.lang.Override - public com.google.protobuf.ByteString getTextDecorationBytes() { - java.lang.Object ref = textDecoration_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - textDecoration_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int FONT_SIZE_FIELD_NUMBER = 7; - private com.google.cloud.documentai.v1beta1.Document.Style.FontSize fontSize_; - /** - * - * - *
-     * Font size.
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - * - * @return Whether the fontSize field is set. - */ - @java.lang.Override - public boolean hasFontSize() { - return ((bitField0_ & 0x00000008) != 0); - } - /** - * - * - *
-     * Font size.
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - * - * @return The fontSize. - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style.FontSize getFontSize() { - return fontSize_ == null - ? com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance() - : fontSize_; - } - /** - * - * - *
-     * Font size.
-     * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder - getFontSizeOrBuilder() { - return fontSize_ == null - ? com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance() - : fontSize_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) != 0)) { - output.writeMessage(1, getTextAnchor()); - } - if (((bitField0_ & 0x00000002) != 0)) { - output.writeMessage(2, getColor()); - } - if (((bitField0_ & 0x00000004) != 0)) { - output.writeMessage(3, getBackgroundColor()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fontWeight_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 4, fontWeight_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(textStyle_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, textStyle_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(textDecoration_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 6, textDecoration_); - } - if (((bitField0_ & 0x00000008) != 0)) { - output.writeMessage(7, getFontSize()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getTextAnchor()); - } - if (((bitField0_ & 0x00000002) != 0)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getColor()); - } - if (((bitField0_ & 0x00000004) != 0)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getBackgroundColor()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(fontWeight_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, fontWeight_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(textStyle_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, textStyle_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(textDecoration_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, textDecoration_); - } - if (((bitField0_ & 0x00000008) != 0)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getFontSize()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.documentai.v1beta1.Document.Style)) { - return super.equals(obj); - } - com.google.cloud.documentai.v1beta1.Document.Style other = - (com.google.cloud.documentai.v1beta1.Document.Style) obj; - - if (hasTextAnchor() != other.hasTextAnchor()) return false; - if (hasTextAnchor()) { - if (!getTextAnchor().equals(other.getTextAnchor())) return false; - } - if (hasColor() != other.hasColor()) return false; - if (hasColor()) { - if (!getColor().equals(other.getColor())) return false; - } - if (hasBackgroundColor() != other.hasBackgroundColor()) return false; - if (hasBackgroundColor()) { - if (!getBackgroundColor().equals(other.getBackgroundColor())) return false; - } - if (!getFontWeight().equals(other.getFontWeight())) return false; - if (!getTextStyle().equals(other.getTextStyle())) return false; - if (!getTextDecoration().equals(other.getTextDecoration())) return false; - if (hasFontSize() != other.hasFontSize()) return false; - if (hasFontSize()) { - if (!getFontSize().equals(other.getFontSize())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasTextAnchor()) { - hash = (37 * hash) + TEXT_ANCHOR_FIELD_NUMBER; - hash = (53 * hash) + getTextAnchor().hashCode(); - } - if (hasColor()) { - hash = (37 * hash) + COLOR_FIELD_NUMBER; - hash = (53 * hash) + getColor().hashCode(); - } - if (hasBackgroundColor()) { - hash = (37 * hash) + BACKGROUND_COLOR_FIELD_NUMBER; - hash = (53 * hash) + getBackgroundColor().hashCode(); - } - hash = (37 * hash) + FONT_WEIGHT_FIELD_NUMBER; - hash = (53 * hash) + getFontWeight().hashCode(); - hash = (37 * hash) + TEXT_STYLE_FIELD_NUMBER; - hash = (53 * hash) + getTextStyle().hashCode(); - hash = (37 * hash) + TEXT_DECORATION_FIELD_NUMBER; - hash = (53 * hash) + getTextDecoration().hashCode(); - if (hasFontSize()) { - hash = (37 * hash) + FONT_SIZE_FIELD_NUMBER; - hash = (53 * hash) + getFontSize().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseDelimitedFrom( - java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( - PARSER, input, extensionRegistry); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException( - PARSER, input, extensionRegistry); - } - - @java.lang.Override - public Builder newBuilderForType() { - return newBuilder(); - } - - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - - public static Builder newBuilder(com.google.cloud.documentai.v1beta1.Document.Style prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-     * Annotation for common text style attributes. This adheres to CSS
-     * conventions as much as possible.
-     * 
- * - * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.Document.Style) - com.google.cloud.documentai.v1beta1.Document.StyleOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.documentai.v1beta1.Document.Style.class, - com.google.cloud.documentai.v1beta1.Document.Style.Builder.class); - } - - // Construct using com.google.cloud.documentai.v1beta1.Document.Style.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getTextAnchorFieldBuilder(); - getColorFieldBuilder(); - getBackgroundColorFieldBuilder(); - getFontSizeFieldBuilder(); - } - } - - @java.lang.Override - public Builder clear() { - super.clear(); - bitField0_ = 0; - textAnchor_ = null; - if (textAnchorBuilder_ != null) { - textAnchorBuilder_.dispose(); - textAnchorBuilder_ = null; - } - color_ = null; - if (colorBuilder_ != null) { - colorBuilder_.dispose(); - colorBuilder_ = null; - } - backgroundColor_ = null; - if (backgroundColorBuilder_ != null) { - backgroundColorBuilder_.dispose(); - backgroundColorBuilder_ = null; - } - fontWeight_ = ""; - textStyle_ = ""; - textDecoration_ = ""; - fontSize_ = null; - if (fontSizeBuilder_ != null) { - fontSizeBuilder_.dispose(); - fontSizeBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.documentai.v1beta1.DocumentProto - .internal_static_google_cloud_documentai_v1beta1_Document_Style_descriptor; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style getDefaultInstanceForType() { - return com.google.cloud.documentai.v1beta1.Document.Style.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style build() { - com.google.cloud.documentai.v1beta1.Document.Style result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.documentai.v1beta1.Document.Style buildPartial() { - com.google.cloud.documentai.v1beta1.Document.Style result = - new com.google.cloud.documentai.v1beta1.Document.Style(this); - if (bitField0_ != 0) { - buildPartial0(result); - } - onBuilt(); - return result; - } - - private void buildPartial0(com.google.cloud.documentai.v1beta1.Document.Style result) { - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) != 0)) { - result.textAnchor_ = - textAnchorBuilder_ == null ? textAnchor_ : textAnchorBuilder_.build(); - to_bitField0_ |= 0x00000001; - } - if (((from_bitField0_ & 0x00000002) != 0)) { - result.color_ = colorBuilder_ == null ? color_ : colorBuilder_.build(); - to_bitField0_ |= 0x00000002; - } - if (((from_bitField0_ & 0x00000004) != 0)) { - result.backgroundColor_ = - backgroundColorBuilder_ == null ? backgroundColor_ : backgroundColorBuilder_.build(); - to_bitField0_ |= 0x00000004; - } - if (((from_bitField0_ & 0x00000008) != 0)) { - result.fontWeight_ = fontWeight_; - } - if (((from_bitField0_ & 0x00000010) != 0)) { - result.textStyle_ = textStyle_; - } - if (((from_bitField0_ & 0x00000020) != 0)) { - result.textDecoration_ = textDecoration_; - } - if (((from_bitField0_ & 0x00000040) != 0)) { - result.fontSize_ = fontSizeBuilder_ == null ? fontSize_ : fontSizeBuilder_.build(); - to_bitField0_ |= 0x00000008; - } - result.bitField0_ |= to_bitField0_; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.documentai.v1beta1.Document.Style) { - return mergeFrom((com.google.cloud.documentai.v1beta1.Document.Style) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.documentai.v1beta1.Document.Style other) { - if (other == com.google.cloud.documentai.v1beta1.Document.Style.getDefaultInstance()) - return this; - if (other.hasTextAnchor()) { - mergeTextAnchor(other.getTextAnchor()); - } - if (other.hasColor()) { - mergeColor(other.getColor()); - } - if (other.hasBackgroundColor()) { - mergeBackgroundColor(other.getBackgroundColor()); - } - if (!other.getFontWeight().isEmpty()) { - fontWeight_ = other.fontWeight_; - bitField0_ |= 0x00000008; - onChanged(); - } - if (!other.getTextStyle().isEmpty()) { - textStyle_ = other.textStyle_; - bitField0_ |= 0x00000010; - onChanged(); - } - if (!other.getTextDecoration().isEmpty()) { - textDecoration_ = other.textDecoration_; - bitField0_ |= 0x00000020; - onChanged(); - } - if (other.hasFontSize()) { - mergeFontSize(other.getFontSize()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getTextAnchorFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000001; - break; - } // case 10 - case 18: - { - input.readMessage(getColorFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000002; - break; - } // case 18 - case 26: - { - input.readMessage( - getBackgroundColorFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000004; - break; - } // case 26 - case 34: - { - fontWeight_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000008; - break; - } // case 34 - case 42: - { - textStyle_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000010; - break; - } // case 42 - case 50: - { - textDecoration_ = input.readStringRequireUtf8(); - bitField0_ |= 0x00000020; - break; - } // case 50 - case 58: - { - input.readMessage(getFontSizeFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000040; - break; - } // case 58 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private com.google.cloud.documentai.v1beta1.Document.TextAnchor textAnchor_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Document.TextAnchor, - com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder, - com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder> - textAnchorBuilder_; - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - * - * @return Whether the textAnchor field is set. - */ - public boolean hasTextAnchor() { - return ((bitField0_ & 0x00000001) != 0); - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - * - * @return The textAnchor. - */ - public com.google.cloud.documentai.v1beta1.Document.TextAnchor getTextAnchor() { - if (textAnchorBuilder_ == null) { - return textAnchor_ == null - ? com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance() - : textAnchor_; - } else { - return textAnchorBuilder_.getMessage(); - } - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - public Builder setTextAnchor(com.google.cloud.documentai.v1beta1.Document.TextAnchor value) { - if (textAnchorBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - textAnchor_ = value; - } else { - textAnchorBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - public Builder setTextAnchor( - com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder builderForValue) { - if (textAnchorBuilder_ == null) { - textAnchor_ = builderForValue.build(); - } else { - textAnchorBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - onChanged(); - return this; - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - public Builder mergeTextAnchor( - com.google.cloud.documentai.v1beta1.Document.TextAnchor value) { - if (textAnchorBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0) - && textAnchor_ != null - && textAnchor_ - != com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance()) { - getTextAnchorBuilder().mergeFrom(value); - } else { - textAnchor_ = value; - } - } else { - textAnchorBuilder_.mergeFrom(value); - } - if (textAnchor_ != null) { - bitField0_ |= 0x00000001; - onChanged(); - } - return this; - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - public Builder clearTextAnchor() { - bitField0_ = (bitField0_ & ~0x00000001); - textAnchor_ = null; - if (textAnchorBuilder_ != null) { - textAnchorBuilder_.dispose(); - textAnchorBuilder_ = null; - } - onChanged(); - return this; - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - public com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder - getTextAnchorBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getTextAnchorFieldBuilder().getBuilder(); - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - public com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder - getTextAnchorOrBuilder() { - if (textAnchorBuilder_ != null) { - return textAnchorBuilder_.getMessageOrBuilder(); - } else { - return textAnchor_ == null - ? com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance() - : textAnchor_; - } - } - /** - * - * - *
-       * Text anchor indexing into the
-       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Document.TextAnchor, - com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder, - com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder> - getTextAnchorFieldBuilder() { - if (textAnchorBuilder_ == null) { - textAnchorBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Document.TextAnchor, - com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder, - com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder>( - getTextAnchor(), getParentForChildren(), isClean()); - textAnchor_ = null; - } - return textAnchorBuilder_; - } - - private com.google.type.Color color_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.type.Color, com.google.type.Color.Builder, com.google.type.ColorOrBuilder> - colorBuilder_; - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - * - * @return Whether the color field is set. - */ - public boolean hasColor() { - return ((bitField0_ & 0x00000002) != 0); - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - * - * @return The color. - */ - public com.google.type.Color getColor() { - if (colorBuilder_ == null) { - return color_ == null ? com.google.type.Color.getDefaultInstance() : color_; - } else { - return colorBuilder_.getMessage(); - } - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - */ - public Builder setColor(com.google.type.Color value) { - if (colorBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - color_ = value; - } else { - colorBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - */ - public Builder setColor(com.google.type.Color.Builder builderForValue) { - if (colorBuilder_ == null) { - color_ = builderForValue.build(); - } else { - colorBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - onChanged(); - return this; - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - */ - public Builder mergeColor(com.google.type.Color value) { - if (colorBuilder_ == null) { - if (((bitField0_ & 0x00000002) != 0) - && color_ != null - && color_ != com.google.type.Color.getDefaultInstance()) { - getColorBuilder().mergeFrom(value); - } else { - color_ = value; - } - } else { - colorBuilder_.mergeFrom(value); - } - if (color_ != null) { - bitField0_ |= 0x00000002; - onChanged(); - } - return this; - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - */ - public Builder clearColor() { - bitField0_ = (bitField0_ & ~0x00000002); - color_ = null; - if (colorBuilder_ != null) { - colorBuilder_.dispose(); - colorBuilder_ = null; - } - onChanged(); - return this; - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - */ - public com.google.type.Color.Builder getColorBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getColorFieldBuilder().getBuilder(); - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - */ - public com.google.type.ColorOrBuilder getColorOrBuilder() { - if (colorBuilder_ != null) { - return colorBuilder_.getMessageOrBuilder(); - } else { - return color_ == null ? com.google.type.Color.getDefaultInstance() : color_; - } - } - /** - * - * - *
-       * Text color.
-       * 
- * - * .google.type.Color color = 2; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.type.Color, com.google.type.Color.Builder, com.google.type.ColorOrBuilder> - getColorFieldBuilder() { - if (colorBuilder_ == null) { - colorBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.type.Color, - com.google.type.Color.Builder, - com.google.type.ColorOrBuilder>(getColor(), getParentForChildren(), isClean()); - color_ = null; - } - return colorBuilder_; - } - - private com.google.type.Color backgroundColor_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.type.Color, com.google.type.Color.Builder, com.google.type.ColorOrBuilder> - backgroundColorBuilder_; - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - * - * @return Whether the backgroundColor field is set. - */ - public boolean hasBackgroundColor() { - return ((bitField0_ & 0x00000004) != 0); - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - * - * @return The backgroundColor. - */ - public com.google.type.Color getBackgroundColor() { - if (backgroundColorBuilder_ == null) { - return backgroundColor_ == null - ? com.google.type.Color.getDefaultInstance() - : backgroundColor_; - } else { - return backgroundColorBuilder_.getMessage(); - } - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - */ - public Builder setBackgroundColor(com.google.type.Color value) { - if (backgroundColorBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - backgroundColor_ = value; - } else { - backgroundColorBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - */ - public Builder setBackgroundColor(com.google.type.Color.Builder builderForValue) { - if (backgroundColorBuilder_ == null) { - backgroundColor_ = builderForValue.build(); - } else { - backgroundColorBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - onChanged(); - return this; - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - */ - public Builder mergeBackgroundColor(com.google.type.Color value) { - if (backgroundColorBuilder_ == null) { - if (((bitField0_ & 0x00000004) != 0) - && backgroundColor_ != null - && backgroundColor_ != com.google.type.Color.getDefaultInstance()) { - getBackgroundColorBuilder().mergeFrom(value); - } else { - backgroundColor_ = value; - } - } else { - backgroundColorBuilder_.mergeFrom(value); - } - if (backgroundColor_ != null) { - bitField0_ |= 0x00000004; - onChanged(); - } - return this; - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - */ - public Builder clearBackgroundColor() { - bitField0_ = (bitField0_ & ~0x00000004); - backgroundColor_ = null; - if (backgroundColorBuilder_ != null) { - backgroundColorBuilder_.dispose(); - backgroundColorBuilder_ = null; - } - onChanged(); - return this; - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - */ - public com.google.type.Color.Builder getBackgroundColorBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getBackgroundColorFieldBuilder().getBuilder(); - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - */ - public com.google.type.ColorOrBuilder getBackgroundColorOrBuilder() { - if (backgroundColorBuilder_ != null) { - return backgroundColorBuilder_.getMessageOrBuilder(); - } else { - return backgroundColor_ == null - ? com.google.type.Color.getDefaultInstance() - : backgroundColor_; - } - } - /** - * - * - *
-       * Text background color.
-       * 
- * - * .google.type.Color background_color = 3; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.type.Color, com.google.type.Color.Builder, com.google.type.ColorOrBuilder> - getBackgroundColorFieldBuilder() { - if (backgroundColorBuilder_ == null) { - backgroundColorBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.type.Color, - com.google.type.Color.Builder, - com.google.type.ColorOrBuilder>( - getBackgroundColor(), getParentForChildren(), isClean()); - backgroundColor_ = null; - } - return backgroundColorBuilder_; - } - - private java.lang.Object fontWeight_ = ""; - /** - * - * - *
-       * Font weight. Possible values are normal, bold, bolder, and lighter.
-       * https://www.w3schools.com/cssref/pr_font_weight.asp
-       * 
- * - * string font_weight = 4; - * - * @return The fontWeight. - */ - public java.lang.String getFontWeight() { - java.lang.Object ref = fontWeight_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - fontWeight_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-       * Font weight. Possible values are normal, bold, bolder, and lighter.
-       * https://www.w3schools.com/cssref/pr_font_weight.asp
-       * 
- * - * string font_weight = 4; - * - * @return The bytes for fontWeight. - */ - public com.google.protobuf.ByteString getFontWeightBytes() { - java.lang.Object ref = fontWeight_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - fontWeight_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-       * Font weight. Possible values are normal, bold, bolder, and lighter.
-       * https://www.w3schools.com/cssref/pr_font_weight.asp
-       * 
- * - * string font_weight = 4; - * - * @param value The fontWeight to set. - * @return This builder for chaining. - */ - public Builder setFontWeight(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - fontWeight_ = value; - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - /** - * - * - *
-       * Font weight. Possible values are normal, bold, bolder, and lighter.
-       * https://www.w3schools.com/cssref/pr_font_weight.asp
-       * 
- * - * string font_weight = 4; - * - * @return This builder for chaining. - */ - public Builder clearFontWeight() { - fontWeight_ = getDefaultInstance().getFontWeight(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - return this; - } - /** - * - * - *
-       * Font weight. Possible values are normal, bold, bolder, and lighter.
-       * https://www.w3schools.com/cssref/pr_font_weight.asp
-       * 
- * - * string font_weight = 4; - * - * @param value The bytes for fontWeight to set. - * @return This builder for chaining. - */ - public Builder setFontWeightBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - fontWeight_ = value; - bitField0_ |= 0x00000008; - onChanged(); - return this; - } - - private java.lang.Object textStyle_ = ""; - /** - * - * - *
-       * Text style. Possible values are normal, italic, and oblique.
-       * https://www.w3schools.com/cssref/pr_font_font-style.asp
-       * 
- * - * string text_style = 5; - * - * @return The textStyle. - */ - public java.lang.String getTextStyle() { - java.lang.Object ref = textStyle_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - textStyle_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-       * Text style. Possible values are normal, italic, and oblique.
-       * https://www.w3schools.com/cssref/pr_font_font-style.asp
-       * 
- * - * string text_style = 5; - * - * @return The bytes for textStyle. - */ - public com.google.protobuf.ByteString getTextStyleBytes() { - java.lang.Object ref = textStyle_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - textStyle_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-       * Text style. Possible values are normal, italic, and oblique.
-       * https://www.w3schools.com/cssref/pr_font_font-style.asp
-       * 
- * - * string text_style = 5; - * - * @param value The textStyle to set. - * @return This builder for chaining. - */ - public Builder setTextStyle(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - textStyle_ = value; - bitField0_ |= 0x00000010; - onChanged(); - return this; - } - /** - * - * - *
-       * Text style. Possible values are normal, italic, and oblique.
-       * https://www.w3schools.com/cssref/pr_font_font-style.asp
-       * 
- * - * string text_style = 5; - * - * @return This builder for chaining. - */ - public Builder clearTextStyle() { - textStyle_ = getDefaultInstance().getTextStyle(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - return this; - } - /** - * - * - *
-       * Text style. Possible values are normal, italic, and oblique.
-       * https://www.w3schools.com/cssref/pr_font_font-style.asp
-       * 
- * - * string text_style = 5; - * - * @param value The bytes for textStyle to set. - * @return This builder for chaining. - */ - public Builder setTextStyleBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - textStyle_ = value; - bitField0_ |= 0x00000010; - onChanged(); - return this; - } - - private java.lang.Object textDecoration_ = ""; - /** - * - * - *
-       * Text decoration. Follows CSS standard.
-       * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-       * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-       * 
- * - * string text_decoration = 6; - * - * @return The textDecoration. - */ - public java.lang.String getTextDecoration() { - java.lang.Object ref = textDecoration_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - textDecoration_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-       * Text decoration. Follows CSS standard.
-       * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-       * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-       * 
- * - * string text_decoration = 6; - * - * @return The bytes for textDecoration. - */ - public com.google.protobuf.ByteString getTextDecorationBytes() { - java.lang.Object ref = textDecoration_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - textDecoration_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-       * Text decoration. Follows CSS standard.
-       * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-       * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-       * 
- * - * string text_decoration = 6; - * - * @param value The textDecoration to set. - * @return This builder for chaining. - */ - public Builder setTextDecoration(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - textDecoration_ = value; - bitField0_ |= 0x00000020; - onChanged(); - return this; - } - /** - * - * - *
-       * Text decoration. Follows CSS standard.
-       * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-       * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-       * 
- * - * string text_decoration = 6; - * - * @return This builder for chaining. - */ - public Builder clearTextDecoration() { - textDecoration_ = getDefaultInstance().getTextDecoration(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - return this; - } - /** - * - * - *
-       * Text decoration. Follows CSS standard.
-       * <text-decoration-line> <text-decoration-color> <text-decoration-style>
-       * https://www.w3schools.com/cssref/pr_text_text-decoration.asp
-       * 
- * - * string text_decoration = 6; - * - * @param value The bytes for textDecoration to set. - * @return This builder for chaining. - */ - public Builder setTextDecorationBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - textDecoration_ = value; - bitField0_ |= 0x00000020; - onChanged(); - return this; - } - - private com.google.cloud.documentai.v1beta1.Document.Style.FontSize fontSize_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Document.Style.FontSize, - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder, - com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder> - fontSizeBuilder_; - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - * - * @return Whether the fontSize field is set. - */ - public boolean hasFontSize() { - return ((bitField0_ & 0x00000040) != 0); - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - * - * @return The fontSize. - */ - public com.google.cloud.documentai.v1beta1.Document.Style.FontSize getFontSize() { - if (fontSizeBuilder_ == null) { - return fontSize_ == null - ? com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance() - : fontSize_; - } else { - return fontSizeBuilder_.getMessage(); - } - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - public Builder setFontSize( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize value) { - if (fontSizeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - fontSize_ = value; - } else { - fontSizeBuilder_.setMessage(value); - } - bitField0_ |= 0x00000040; - onChanged(); - return this; - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - public Builder setFontSize( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder builderForValue) { - if (fontSizeBuilder_ == null) { - fontSize_ = builderForValue.build(); - } else { - fontSizeBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000040; - onChanged(); - return this; - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - public Builder mergeFontSize( - com.google.cloud.documentai.v1beta1.Document.Style.FontSize value) { - if (fontSizeBuilder_ == null) { - if (((bitField0_ & 0x00000040) != 0) - && fontSize_ != null - && fontSize_ - != com.google.cloud.documentai.v1beta1.Document.Style.FontSize - .getDefaultInstance()) { - getFontSizeBuilder().mergeFrom(value); - } else { - fontSize_ = value; - } - } else { - fontSizeBuilder_.mergeFrom(value); - } - if (fontSize_ != null) { - bitField0_ |= 0x00000040; - onChanged(); - } - return this; - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - public Builder clearFontSize() { - bitField0_ = (bitField0_ & ~0x00000040); - fontSize_ = null; - if (fontSizeBuilder_ != null) { - fontSizeBuilder_.dispose(); - fontSizeBuilder_ = null; - } - onChanged(); - return this; - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - public com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder - getFontSizeBuilder() { - bitField0_ |= 0x00000040; - onChanged(); - return getFontSizeFieldBuilder().getBuilder(); - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - public com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder - getFontSizeOrBuilder() { - if (fontSizeBuilder_ != null) { - return fontSizeBuilder_.getMessageOrBuilder(); - } else { - return fontSize_ == null - ? com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance() - : fontSize_; - } - } - /** - * - * - *
-       * Font size.
-       * 
- * - * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Document.Style.FontSize, - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder, - com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder> - getFontSizeFieldBuilder() { - if (fontSizeBuilder_ == null) { - fontSizeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.documentai.v1beta1.Document.Style.FontSize, - com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder, - com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder>( - getFontSize(), getParentForChildren(), isClean()); - fontSize_ = null; - } - return fontSizeBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.Document.Style) - } - - // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.Document.Style) - private static final com.google.cloud.documentai.v1beta1.Document.Style DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.Document.Style(); - } - - public static com.google.cloud.documentai.v1beta1.Document.Style getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser