diff --git a/README.md b/README.md index bba37a81..4e6d7354 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-document-ai - 0.2.1 + 0.2.4 ``` diff --git a/google-cloud-document-ai-bom/pom.xml b/google-cloud-document-ai-bom/pom.xml index ebe988ac..dfa3af27 100644 --- a/google-cloud-document-ai-bom/pom.xml +++ b/google-cloud-document-ai-bom/pom.xml @@ -1,100 +1,110 @@ - 4.0.0 + 4.0.0 + com.google.cloud + google-cloud-document-ai-bom + 0.2.5-SNAPSHOT + pom + com.google.cloud - google-cloud-document-ai-bom - 0.2.5-SNAPSHOT - pom - - com.google.cloud - google-cloud-shared-config - 0.9.2 - + google-cloud-shared-config + 0.9.2 + - Google Cloud Document AI BOM - https://github.com/googleapis/java-document-ai - BOM for Google Cloud Document AI + Google Cloud Document AI BOM + https://github.com/googleapis/java-document-ai + BOM for Google Cloud Document AI - - Google LLC - + + Google LLC + - - - chingor13 - Jeff Ching - chingor@google.com - Google LLC - - Developer - - - + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + - - scm:git:https://github.com/googleapis/java-document-ai.git - scm:git:git@github.com:googleapis/java-document-ai.git - https://github.com/googleapis/java-document-ai - + + scm:git:https://github.com/googleapis/java-document-ai.git + scm:git:git@github.com:googleapis/java-document-ai.git + https://github.com/googleapis/java-document-ai + - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - + + + sonatype-nexus-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + - - - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta1 - 0.2.5-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-document-ai-v1beta2 - 0.2.5-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta1 - 0.2.5-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-document-ai-v1beta2 - 0.2.5-SNAPSHOT - - - com.google.cloud - google-cloud-document-ai - 0.2.5-SNAPSHOT - - - + + + + com.google.api.grpc + proto-google-cloud-document-ai-v1beta1 + 0.2.5-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-document-ai-v1beta2 + 0.2.5-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-document-ai-v1beta3 + 0.2.5-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-document-ai-v1beta1 + 0.2.5-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-document-ai-v1beta2 + 0.2.5-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-document-ai-v1beta3 + 0.2.5-SNAPSHOT + + + com.google.cloud + google-cloud-document-ai + 0.2.5-SNAPSHOT + + + - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - - - - + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + \ No newline at end of file diff --git a/google-cloud-document-ai/pom.xml b/google-cloud-document-ai/pom.xml index d041ecf6..3aaffdc5 100644 --- a/google-cloud-document-ai/pom.xml +++ b/google-cloud-document-ai/pom.xml @@ -50,6 +50,10 @@ com.google.api.grpc proto-google-cloud-document-ai-v1beta2 + + com.google.api.grpc + proto-google-cloud-document-ai-v1beta3 + com.google.guava guava @@ -83,6 +87,11 @@ grpc-google-cloud-document-ai-v1beta2 test + + com.google.api.grpc + grpc-google-cloud-document-ai-v1beta3 + test + diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java new file mode 100644 index 00000000..5715eb78 --- /dev/null +++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClient.java @@ -0,0 +1,545 @@ +/* + * Copyright 2020 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.v1beta3; + +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.v1beta3.stub.DocumentProcessorServiceStub; +import com.google.cloud.documentai.v1beta3.stub.DocumentProcessorServiceStubSettings; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Service to call Cloud DocumentAI to process documents according to the + * processor's definition. Processors are built using state-of-the-art Google AI such as natural + * language, computer vision, and translation to extract structured information from unstructured or + * semi-structured documents. + * + *

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: + * + *

+ * 
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+ *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ *   ProcessResponse response = documentProcessorServiceClient.processDocument(name);
+ * }
+ * 
+ * 
+ * + *

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

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

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 + * DocumentProcessorServiceSettings to create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * DocumentProcessorServiceSettings documentProcessorServiceSettings =
+ *     DocumentProcessorServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * DocumentProcessorServiceClient documentProcessorServiceClient =
+ *     DocumentProcessorServiceClient.create(documentProcessorServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * DocumentProcessorServiceSettings documentProcessorServiceSettings =
+ *     DocumentProcessorServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * DocumentProcessorServiceClient documentProcessorServiceClient =
+ *     DocumentProcessorServiceClient.create(documentProcessorServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DocumentProcessorServiceClient implements BackgroundResource { + private final DocumentProcessorServiceSettings settings; + private final DocumentProcessorServiceStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of DocumentProcessorServiceClient with default settings. */ + public static final DocumentProcessorServiceClient create() throws IOException { + return create(DocumentProcessorServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of DocumentProcessorServiceClient, 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 DocumentProcessorServiceClient create( + DocumentProcessorServiceSettings settings) throws IOException { + return new DocumentProcessorServiceClient(settings); + } + + /** + * Constructs an instance of DocumentProcessorServiceClient, using the given stub for making + * calls. This is for advanced usage - prefer to use DocumentProcessorServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final DocumentProcessorServiceClient create(DocumentProcessorServiceStub stub) { + return new DocumentProcessorServiceClient(stub); + } + + /** + * Constructs an instance of DocumentProcessorServiceClient, 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 DocumentProcessorServiceClient(DocumentProcessorServiceSettings settings) + throws IOException { + this.settings = settings; + this.stub = ((DocumentProcessorServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected DocumentProcessorServiceClient(DocumentProcessorServiceStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final DocumentProcessorServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DocumentProcessorServiceStub 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. + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Processes a single document. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ProcessResponse response = documentProcessorServiceClient.processDocument(name);
+   * }
+   * 
+ * + * @param name Required. The processor resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ProcessResponse processDocument(ProcessorName name) { + ProcessRequest request = + ProcessRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return processDocument(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Processes a single document. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ProcessResponse response = documentProcessorServiceClient.processDocument(name.toString());
+   * }
+   * 
+ * + * @param name Required. The processor resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ProcessResponse processDocument(String name) { + ProcessRequest request = ProcessRequest.newBuilder().setName(name).build(); + return processDocument(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Processes a single document. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ProcessRequest request = ProcessRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ProcessResponse response = documentProcessorServiceClient.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 ProcessResponse processDocument(ProcessRequest request) { + return processDocumentCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Processes a single document. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ProcessRequest request = ProcessRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ProcessResponse> future = documentProcessorServiceClient.processDocumentCallable().futureCall(request);
+   *   // Do something
+   *   ProcessResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable processDocumentCallable() { + return stub.processDocumentCallable(); + } + + // 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: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   BatchProcessResponse response = documentProcessorServiceClient.batchProcessDocumentsAsync(name).get();
+   * }
+   * 
+ * + * @param name Required. The processor resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + batchProcessDocumentsAsync(ProcessorName name) { + BatchProcessRequest request = + BatchProcessRequest.newBuilder().setName(name == null ? null : name.toString()).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: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   BatchProcessResponse response = documentProcessorServiceClient.batchProcessDocumentsAsync(name.toString()).get();
+   * }
+   * 
+ * + * @param name Required. The processor resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + batchProcessDocumentsAsync(String name) { + BatchProcessRequest request = BatchProcessRequest.newBuilder().setName(name).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: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   BatchProcessRequest request = BatchProcessRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   BatchProcessResponse response = documentProcessorServiceClient.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 + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + batchProcessDocumentsAsync(BatchProcessRequest 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: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   BatchProcessRequest request = BatchProcessRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   OperationFuture<BatchProcessResponse, BatchProcessMetadata> future = documentProcessorServiceClient.batchProcessDocumentsOperationCallable().futureCall(request);
+   *   // Do something
+   *   BatchProcessResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable + 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: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   BatchProcessRequest request = BatchProcessRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = documentProcessorServiceClient.batchProcessDocumentsCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable batchProcessDocumentsCallable() { + return stub.batchProcessDocumentsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Send a document for Human Review. The input document should be processed by the specified + * processor. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ReviewDocumentResponse response = documentProcessorServiceClient.reviewDocumentAsync(humanReviewConfig).get();
+   * }
+   * 
+ * + * @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document + * will be reviewed with. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + reviewDocumentAsync(HumanReviewConfigName humanReviewConfig) { + ReviewDocumentRequest request = + ReviewDocumentRequest.newBuilder() + .setHumanReviewConfig(humanReviewConfig == null ? null : humanReviewConfig.toString()) + .build(); + return reviewDocumentAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Send a document for Human Review. The input document should be processed by the specified + * processor. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ReviewDocumentResponse response = documentProcessorServiceClient.reviewDocumentAsync(humanReviewConfig.toString()).get();
+   * }
+   * 
+ * + * @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document + * will be reviewed with. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + reviewDocumentAsync(String humanReviewConfig) { + ReviewDocumentRequest request = + ReviewDocumentRequest.newBuilder().setHumanReviewConfig(humanReviewConfig).build(); + return reviewDocumentAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Send a document for Human Review. The input document should be processed by the specified + * processor. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ReviewDocumentRequest request = ReviewDocumentRequest.newBuilder()
+   *     .setHumanReviewConfig(humanReviewConfig.toString())
+   *     .build();
+   *   ReviewDocumentResponse response = documentProcessorServiceClient.reviewDocumentAsync(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 + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + reviewDocumentAsync(ReviewDocumentRequest request) { + return reviewDocumentOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Send a document for Human Review. The input document should be processed by the specified + * processor. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ReviewDocumentRequest request = ReviewDocumentRequest.newBuilder()
+   *     .setHumanReviewConfig(humanReviewConfig.toString())
+   *     .build();
+   *   OperationFuture<ReviewDocumentResponse, ReviewDocumentOperationMetadata> future = documentProcessorServiceClient.reviewDocumentOperationCallable().futureCall(request);
+   *   // Do something
+   *   ReviewDocumentResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationCallable() { + return stub.reviewDocumentOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Send a document for Human Review. The input document should be processed by the specified + * processor. + * + *

Sample code: + * + *


+   * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+   *   HumanReviewConfigName humanReviewConfig = HumanReviewConfigName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+   *   ReviewDocumentRequest request = ReviewDocumentRequest.newBuilder()
+   *     .setHumanReviewConfig(humanReviewConfig.toString())
+   *     .build();
+   *   ApiFuture<Operation> future = documentProcessorServiceClient.reviewDocumentCallable().futureCall(request);
+   *   // Do something
+   *   Operation response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable reviewDocumentCallable() { + return stub.reviewDocumentCallable(); + } + + @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/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java new file mode 100644 index 00000000..0a65f139 --- /dev/null +++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceSettings.java @@ -0,0 +1,242 @@ +/* + * Copyright 2020 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.v1beta3; + +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.v1beta3.stub.DocumentProcessorServiceStubSettings; +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 DocumentProcessorServiceClient}. + * + *

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

    + *
  • The default service address (us-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 total timeout of processDocument to 30 seconds: + * + *

+ * 
+ * DocumentProcessorServiceSettings.Builder documentProcessorServiceSettingsBuilder =
+ *     DocumentProcessorServiceSettings.newBuilder();
+ * documentProcessorServiceSettingsBuilder
+ *     .processDocumentSettings()
+ *     .setRetrySettings(
+ *         documentProcessorServiceSettingsBuilder.processDocumentSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * DocumentProcessorServiceSettings documentProcessorServiceSettings = documentProcessorServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DocumentProcessorServiceSettings + extends ClientSettings { + /** Returns the object with the settings used for calls to processDocument. */ + public UnaryCallSettings processDocumentSettings() { + return ((DocumentProcessorServiceStubSettings) getStubSettings()).processDocumentSettings(); + } + + /** Returns the object with the settings used for calls to batchProcessDocuments. */ + public UnaryCallSettings batchProcessDocumentsSettings() { + return ((DocumentProcessorServiceStubSettings) getStubSettings()) + .batchProcessDocumentsSettings(); + } + + /** Returns the object with the settings used for calls to batchProcessDocuments. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings + batchProcessDocumentsOperationSettings() { + return ((DocumentProcessorServiceStubSettings) getStubSettings()) + .batchProcessDocumentsOperationSettings(); + } + + /** Returns the object with the settings used for calls to reviewDocument. */ + public UnaryCallSettings reviewDocumentSettings() { + return ((DocumentProcessorServiceStubSettings) getStubSettings()).reviewDocumentSettings(); + } + + /** Returns the object with the settings used for calls to reviewDocument. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationSettings() { + return ((DocumentProcessorServiceStubSettings) getStubSettings()) + .reviewDocumentOperationSettings(); + } + + public static final DocumentProcessorServiceSettings create( + DocumentProcessorServiceStubSettings stub) throws IOException { + return new DocumentProcessorServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return DocumentProcessorServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return DocumentProcessorServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DocumentProcessorServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return DocumentProcessorServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return DocumentProcessorServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return DocumentProcessorServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DocumentProcessorServiceStubSettings.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 DocumentProcessorServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for DocumentProcessorServiceSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(DocumentProcessorServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(DocumentProcessorServiceStubSettings.newBuilder()); + } + + protected Builder(DocumentProcessorServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(DocumentProcessorServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public DocumentProcessorServiceStubSettings.Builder getStubSettingsBuilder() { + return ((DocumentProcessorServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * 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) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** 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 batchProcessDocuments. */ + public UnaryCallSettings.Builder + batchProcessDocumentsSettings() { + return getStubSettingsBuilder().batchProcessDocumentsSettings(); + } + + /** Returns the builder for the settings used for calls to batchProcessDocuments. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + BatchProcessRequest, BatchProcessResponse, BatchProcessMetadata> + batchProcessDocumentsOperationSettings() { + return getStubSettingsBuilder().batchProcessDocumentsOperationSettings(); + } + + /** Returns the builder for the settings used for calls to reviewDocument. */ + public UnaryCallSettings.Builder reviewDocumentSettings() { + return getStubSettingsBuilder().reviewDocumentSettings(); + } + + /** Returns the builder for the settings used for calls to reviewDocument. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationSettings() { + return getStubSettingsBuilder().reviewDocumentOperationSettings(); + } + + @Override + public DocumentProcessorServiceSettings build() throws IOException { + return new DocumentProcessorServiceSettings(this); + } + } +} diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java new file mode 100644 index 00000000..62aab8d1 --- /dev/null +++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/package-info.java @@ -0,0 +1,43 @@ +/* + * Copyright 2020 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. + * + *

============================== DocumentProcessorServiceClient ============================== + * + *

Service Description: Service to call Cloud DocumentAI to process documents according to the + * processor's definition. Processors are built using state-of-the-art Google AI such as natural + * language, computer vision, and translation to extract structured information from unstructured or + * semi-structured documents. + * + *

Sample for DocumentProcessorServiceClient: + * + *

+ * 
+ * try (DocumentProcessorServiceClient documentProcessorServiceClient = DocumentProcessorServiceClient.create()) {
+ *   ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]");
+ *   ProcessResponse response = documentProcessorServiceClient.processDocument(name);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.documentai.v1beta3; + +import javax.annotation.Generated; diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java new file mode 100644 index 00000000..a408e717 --- /dev/null +++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStub.java @@ -0,0 +1,77 @@ +/* + * Copyright 2020 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.v1beta3.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.v1beta3.BatchProcessMetadata; +import com.google.cloud.documentai.v1beta3.BatchProcessRequest; +import com.google.cloud.documentai.v1beta3.BatchProcessResponse; +import com.google.cloud.documentai.v1beta3.ProcessRequest; +import com.google.cloud.documentai.v1beta3.ProcessResponse; +import com.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; +import com.google.cloud.documentai.v1beta3.ReviewDocumentRequest; +import com.google.cloud.documentai.v1beta3.ReviewDocumentResponse; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Cloud Document AI API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class DocumentProcessorServiceStub implements BackgroundResource { + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + public UnaryCallable processDocumentCallable() { + throw new UnsupportedOperationException("Not implemented: processDocumentCallable()"); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + batchProcessDocumentsOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: batchProcessDocumentsOperationCallable()"); + } + + public UnaryCallable batchProcessDocumentsCallable() { + throw new UnsupportedOperationException("Not implemented: batchProcessDocumentsCallable()"); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationCallable() { + throw new UnsupportedOperationException("Not implemented: reviewDocumentOperationCallable()"); + } + + public UnaryCallable reviewDocumentCallable() { + throw new UnsupportedOperationException("Not implemented: reviewDocumentCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java new file mode 100644 index 00000000..acab2af4 --- /dev/null +++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/DocumentProcessorServiceStubSettings.java @@ -0,0 +1,435 @@ +/* + * Copyright 2020 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.v1beta3.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +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.v1beta3.BatchProcessMetadata; +import com.google.cloud.documentai.v1beta3.BatchProcessRequest; +import com.google.cloud.documentai.v1beta3.BatchProcessResponse; +import com.google.cloud.documentai.v1beta3.ProcessRequest; +import com.google.cloud.documentai.v1beta3.ProcessResponse; +import com.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; +import com.google.cloud.documentai.v1beta3.ReviewDocumentRequest; +import com.google.cloud.documentai.v1beta3.ReviewDocumentResponse; +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 DocumentProcessorServiceStub}. + * + *

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

    + *
  • The default service address (us-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 total timeout of processDocument to 30 seconds: + * + *

+ * 
+ * DocumentProcessorServiceStubSettings.Builder documentProcessorServiceSettingsBuilder =
+ *     DocumentProcessorServiceStubSettings.newBuilder();
+ * documentProcessorServiceSettingsBuilder
+ *     .processDocumentSettings()
+ *     .setRetrySettings(
+ *         documentProcessorServiceSettingsBuilder.processDocumentSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * DocumentProcessorServiceStubSettings documentProcessorServiceSettings = documentProcessorServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DocumentProcessorServiceStubSettings + 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 processDocumentSettings; + private final UnaryCallSettings batchProcessDocumentsSettings; + private final OperationCallSettings< + BatchProcessRequest, BatchProcessResponse, BatchProcessMetadata> + batchProcessDocumentsOperationSettings; + private final UnaryCallSettings reviewDocumentSettings; + private final OperationCallSettings< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationSettings; + + /** 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 batchProcessDocuments. */ + public UnaryCallSettings batchProcessDocumentsSettings() { + return batchProcessDocumentsSettings; + } + + /** Returns the object with the settings used for calls to batchProcessDocuments. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings + batchProcessDocumentsOperationSettings() { + return batchProcessDocumentsOperationSettings; + } + + /** Returns the object with the settings used for calls to reviewDocument. */ + public UnaryCallSettings reviewDocumentSettings() { + return reviewDocumentSettings; + } + + /** Returns the object with the settings used for calls to reviewDocument. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationSettings() { + return reviewDocumentOperationSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DocumentProcessorServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcDocumentProcessorServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "us-documentai.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); + } + + /** 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(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(DocumentProcessorServiceStubSettings.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 DocumentProcessorServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + processDocumentSettings = settingsBuilder.processDocumentSettings().build(); + batchProcessDocumentsSettings = settingsBuilder.batchProcessDocumentsSettings().build(); + batchProcessDocumentsOperationSettings = + settingsBuilder.batchProcessDocumentsOperationSettings().build(); + reviewDocumentSettings = settingsBuilder.reviewDocumentSettings().build(); + reviewDocumentOperationSettings = settingsBuilder.reviewDocumentOperationSettings().build(); + } + + /** Builder for DocumentProcessorServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + processDocumentSettings; + private final UnaryCallSettings.Builder + batchProcessDocumentsSettings; + private final OperationCallSettings.Builder< + BatchProcessRequest, BatchProcessResponse, BatchProcessMetadata> + batchProcessDocumentsOperationSettings; + private final UnaryCallSettings.Builder + reviewDocumentSettings; + private final OperationCallSettings.Builder< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_1_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_1_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); + + processDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + batchProcessDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + batchProcessDocumentsOperationSettings = OperationCallSettings.newBuilder(); + + reviewDocumentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + reviewDocumentOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + processDocumentSettings, batchProcessDocumentsSettings, reviewDocumentSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .processDocumentSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + + builder + .batchProcessDocumentsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + + builder + .reviewDocumentSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + builder + .batchProcessDocumentsOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(BatchProcessResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(BatchProcessMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(500L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(5000L)) + .setInitialRpcTimeout(Duration.ZERO) // ignored + .setRpcTimeoutMultiplier(1.0) // ignored + .setMaxRpcTimeout(Duration.ZERO) // ignored + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + builder + .reviewDocumentOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(ReviewDocumentResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create( + ReviewDocumentOperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(500L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(5000L)) + .setInitialRpcTimeout(Duration.ZERO) // ignored + .setRpcTimeoutMultiplier(1.0) // ignored + .setMaxRpcTimeout(Duration.ZERO) // ignored + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + protected Builder(DocumentProcessorServiceStubSettings settings) { + super(settings); + + processDocumentSettings = settings.processDocumentSettings.toBuilder(); + batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder(); + batchProcessDocumentsOperationSettings = + settings.batchProcessDocumentsOperationSettings.toBuilder(); + reviewDocumentSettings = settings.reviewDocumentSettings.toBuilder(); + reviewDocumentOperationSettings = settings.reviewDocumentOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + processDocumentSettings, batchProcessDocumentsSettings, reviewDocumentSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * 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) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** 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 batchProcessDocuments. */ + public UnaryCallSettings.Builder + batchProcessDocumentsSettings() { + return batchProcessDocumentsSettings; + } + + /** Returns the builder for the settings used for calls to batchProcessDocuments. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + BatchProcessRequest, BatchProcessResponse, BatchProcessMetadata> + batchProcessDocumentsOperationSettings() { + return batchProcessDocumentsOperationSettings; + } + + /** Returns the builder for the settings used for calls to reviewDocument. */ + public UnaryCallSettings.Builder reviewDocumentSettings() { + return reviewDocumentSettings; + } + + /** Returns the builder for the settings used for calls to reviewDocument. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationSettings() { + return reviewDocumentOperationSettings; + } + + @Override + public DocumentProcessorServiceStubSettings build() throws IOException { + return new DocumentProcessorServiceStubSettings(this); + } + } +} diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceCallableFactory.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceCallableFactory.java new file mode 100644 index 00000000..17df0bd9 --- /dev/null +++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2020 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.v1beta3.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.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Cloud Document AI API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcDocumentProcessorServiceCallableFactory 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 pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java new file mode 100644 index 00000000..e73f292b --- /dev/null +++ b/google-cloud-document-ai/src/main/java/com/google/cloud/documentai/v1beta3/stub/GrpcDocumentProcessorServiceStub.java @@ -0,0 +1,266 @@ +/* + * Copyright 2020 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.v1beta3.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.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.documentai.v1beta3.BatchProcessMetadata; +import com.google.cloud.documentai.v1beta3.BatchProcessRequest; +import com.google.cloud.documentai.v1beta3.BatchProcessResponse; +import com.google.cloud.documentai.v1beta3.ProcessRequest; +import com.google.cloud.documentai.v1beta3.ProcessResponse; +import com.google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata; +import com.google.cloud.documentai.v1beta3.ReviewDocumentRequest; +import com.google.cloud.documentai.v1beta3.ReviewDocumentResponse; +import com.google.common.collect.ImmutableMap; +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.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Cloud Document AI API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcDocumentProcessorServiceStub extends DocumentProcessorServiceStub { + + private static final MethodDescriptor + processDocumentMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.documentai.v1beta3.DocumentProcessorService/ProcessDocument") + .setRequestMarshaller(ProtoUtils.marshaller(ProcessRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ProcessResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + batchProcessDocumentsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.documentai.v1beta3.DocumentProcessorService/BatchProcessDocuments") + .setRequestMarshaller(ProtoUtils.marshaller(BatchProcessRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + private static final MethodDescriptor + reviewDocumentMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.documentai.v1beta3.DocumentProcessorService/ReviewDocument") + .setRequestMarshaller( + ProtoUtils.marshaller(ReviewDocumentRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + + private final UnaryCallable processDocumentCallable; + private final UnaryCallable batchProcessDocumentsCallable; + private final OperationCallable + batchProcessDocumentsOperationCallable; + private final UnaryCallable reviewDocumentCallable; + private final OperationCallable< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcDocumentProcessorServiceStub create( + DocumentProcessorServiceStubSettings settings) throws IOException { + return new GrpcDocumentProcessorServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcDocumentProcessorServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcDocumentProcessorServiceStub( + DocumentProcessorServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcDocumentProcessorServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcDocumentProcessorServiceStub( + DocumentProcessorServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcDocumentProcessorServiceStub, 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 GrpcDocumentProcessorServiceStub( + DocumentProcessorServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcDocumentProcessorServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcDocumentProcessorServiceStub, 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 GrpcDocumentProcessorServiceStub( + DocumentProcessorServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings processDocumentTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(processDocumentMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ProcessRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings batchProcessDocumentsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(batchProcessDocumentsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(BatchProcessRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings reviewDocumentTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(reviewDocumentMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ReviewDocumentRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "human_review_config", String.valueOf(request.getHumanReviewConfig())); + return params.build(); + } + }) + .build(); + + this.processDocumentCallable = + callableFactory.createUnaryCallable( + processDocumentTransportSettings, settings.processDocumentSettings(), clientContext); + this.batchProcessDocumentsCallable = + callableFactory.createUnaryCallable( + batchProcessDocumentsTransportSettings, + settings.batchProcessDocumentsSettings(), + clientContext); + this.batchProcessDocumentsOperationCallable = + callableFactory.createOperationCallable( + batchProcessDocumentsTransportSettings, + settings.batchProcessDocumentsOperationSettings(), + clientContext, + this.operationsStub); + this.reviewDocumentCallable = + callableFactory.createUnaryCallable( + reviewDocumentTransportSettings, settings.reviewDocumentSettings(), clientContext); + this.reviewDocumentOperationCallable = + callableFactory.createOperationCallable( + reviewDocumentTransportSettings, + settings.reviewDocumentOperationSettings(), + clientContext, + this.operationsStub); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + public UnaryCallable processDocumentCallable() { + return processDocumentCallable; + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable + batchProcessDocumentsOperationCallable() { + return batchProcessDocumentsOperationCallable; + } + + public UnaryCallable batchProcessDocumentsCallable() { + return batchProcessDocumentsCallable; + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable< + ReviewDocumentRequest, ReviewDocumentResponse, ReviewDocumentOperationMetadata> + reviewDocumentOperationCallable() { + return reviewDocumentOperationCallable; + } + + public UnaryCallable reviewDocumentCallable() { + return reviewDocumentCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @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/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientTest.java b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientTest.java new file mode 100644 index 00000000..a2cbe5af --- /dev/null +++ b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceClientTest.java @@ -0,0 +1,218 @@ +/* + * Copyright 2020 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.v1beta3; + +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.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class DocumentProcessorServiceClientTest { + private static MockDocumentProcessorService mockDocumentProcessorService; + private static MockServiceHelper serviceHelper; + private DocumentProcessorServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockDocumentProcessorService = new MockDocumentProcessorService(); + serviceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockDocumentProcessorService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + DocumentProcessorServiceSettings settings = + DocumentProcessorServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DocumentProcessorServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void processDocumentTest() { + String humanReviewOperation = "humanReviewOperation2074827282"; + ProcessResponse expectedResponse = + ProcessResponse.newBuilder().setHumanReviewOperation(humanReviewOperation).build(); + mockDocumentProcessorService.addResponse(expectedResponse); + + ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]"); + + ProcessResponse actualResponse = client.processDocument(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDocumentProcessorService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ProcessRequest actualRequest = (ProcessRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProcessorName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void processDocumentExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDocumentProcessorService.addException(exception); + + try { + ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]"); + + client.processDocument(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void batchProcessDocumentsTest() throws Exception { + BatchProcessResponse expectedResponse = BatchProcessResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("batchProcessDocumentsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockDocumentProcessorService.addResponse(resultOperation); + + ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]"); + + BatchProcessResponse actualResponse = client.batchProcessDocumentsAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDocumentProcessorService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + BatchProcessRequest actualRequest = (BatchProcessRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProcessorName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void batchProcessDocumentsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDocumentProcessorService.addException(exception); + + try { + ProcessorName name = ProcessorName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]"); + + client.batchProcessDocumentsAsync(name).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 + @SuppressWarnings("all") + public void reviewDocumentTest() throws Exception { + String gcsDestination = "gcsDestination714819302"; + ReviewDocumentResponse expectedResponse = + ReviewDocumentResponse.newBuilder().setGcsDestination(gcsDestination).build(); + Operation resultOperation = + Operation.newBuilder() + .setName("reviewDocumentTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockDocumentProcessorService.addResponse(resultOperation); + + HumanReviewConfigName humanReviewConfig = + HumanReviewConfigName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]"); + + ReviewDocumentResponse actualResponse = client.reviewDocumentAsync(humanReviewConfig).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDocumentProcessorService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ReviewDocumentRequest actualRequest = (ReviewDocumentRequest) actualRequests.get(0); + + Assert.assertEquals( + humanReviewConfig, HumanReviewConfigName.parse(actualRequest.getHumanReviewConfig())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void reviewDocumentExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDocumentProcessorService.addException(exception); + + try { + HumanReviewConfigName humanReviewConfig = + HumanReviewConfigName.of("[PROJECT]", "[LOCATION]", "[PROCESSOR]"); + + client.reviewDocumentAsync(humanReviewConfig).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/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorService.java b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorService.java new file mode 100644 index 00000000..c6290b63 --- /dev/null +++ b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorService.java @@ -0,0 +1,57 @@ +/* + * Copyright 2020 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.v1beta3; + +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockDocumentProcessorService implements MockGrpcService { + private final MockDocumentProcessorServiceImpl serviceImpl; + + public MockDocumentProcessorService() { + serviceImpl = new MockDocumentProcessorServiceImpl(); + } + + @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/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java new file mode 100644 index 00000000..1fd3177d --- /dev/null +++ b/google-cloud-document-ai/src/test/java/com/google/cloud/documentai/v1beta3/MockDocumentProcessorServiceImpl.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 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.v1beta3; + +import com.google.api.core.BetaApi; +import com.google.cloud.documentai.v1beta3.DocumentProcessorServiceGrpc.DocumentProcessorServiceImplBase; +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockDocumentProcessorServiceImpl extends DocumentProcessorServiceImplBase { + private List requests; + private Queue responses; + + public MockDocumentProcessorServiceImpl() { + 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 processDocument( + ProcessRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ProcessResponse) { + requests.add(request); + responseObserver.onNext((ProcessResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void batchProcessDocuments( + BatchProcessRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } + + @Override + public void reviewDocument( + ReviewDocumentRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } +} diff --git a/grpc-google-cloud-document-ai-v1beta3/pom.xml b/grpc-google-cloud-document-ai-v1beta3/pom.xml new file mode 100644 index 00000000..fda0a037 --- /dev/null +++ b/grpc-google-cloud-document-ai-v1beta3/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-document-ai-v1beta3 + 0.2.5-SNAPSHOT + grpc-google-cloud-document-ai-v1beta3 + GRPC library for grpc-google-cloud-document-ai-v1beta3 + + com.google.cloud + google-cloud-document-ai-parent + 0.2.5-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-v1beta3 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/grpc-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceGrpc.java b/grpc-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceGrpc.java new file mode 100644 index 00000000..275f4d2d --- /dev/null +++ b/grpc-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/DocumentProcessorServiceGrpc.java @@ -0,0 +1,626 @@ +/* + * Copyright 2020 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.v1beta3; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * Service to call Cloud DocumentAI to process documents according to the
+ * processor's definition. Processors are built using state-of-the-art Google
+ * AI such as natural language, computer vision, and translation to extract
+ * structured information from unstructured or semi-structured documents.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/documentai/v1beta3/document_processor_service.proto") +public final class DocumentProcessorServiceGrpc { + + private DocumentProcessorServiceGrpc() {} + + public static final String SERVICE_NAME = + "google.cloud.documentai.v1beta3.DocumentProcessorService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.ProcessRequest, + com.google.cloud.documentai.v1beta3.ProcessResponse> + getProcessDocumentMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ProcessDocument", + requestType = com.google.cloud.documentai.v1beta3.ProcessRequest.class, + responseType = com.google.cloud.documentai.v1beta3.ProcessResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.ProcessRequest, + com.google.cloud.documentai.v1beta3.ProcessResponse> + getProcessDocumentMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.ProcessRequest, + com.google.cloud.documentai.v1beta3.ProcessResponse> + getProcessDocumentMethod; + if ((getProcessDocumentMethod = DocumentProcessorServiceGrpc.getProcessDocumentMethod) + == null) { + synchronized (DocumentProcessorServiceGrpc.class) { + if ((getProcessDocumentMethod = DocumentProcessorServiceGrpc.getProcessDocumentMethod) + == null) { + DocumentProcessorServiceGrpc.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.v1beta3.ProcessRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.documentai.v1beta3.ProcessResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new DocumentProcessorServiceMethodDescriptorSupplier("ProcessDocument")) + .build(); + } + } + } + return getProcessDocumentMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.BatchProcessRequest, com.google.longrunning.Operation> + getBatchProcessDocumentsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "BatchProcessDocuments", + requestType = com.google.cloud.documentai.v1beta3.BatchProcessRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.BatchProcessRequest, com.google.longrunning.Operation> + getBatchProcessDocumentsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.BatchProcessRequest, + com.google.longrunning.Operation> + getBatchProcessDocumentsMethod; + if ((getBatchProcessDocumentsMethod = + DocumentProcessorServiceGrpc.getBatchProcessDocumentsMethod) + == null) { + synchronized (DocumentProcessorServiceGrpc.class) { + if ((getBatchProcessDocumentsMethod = + DocumentProcessorServiceGrpc.getBatchProcessDocumentsMethod) + == null) { + DocumentProcessorServiceGrpc.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.v1beta3.BatchProcessRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new DocumentProcessorServiceMethodDescriptorSupplier( + "BatchProcessDocuments")) + .build(); + } + } + } + return getBatchProcessDocumentsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest, + com.google.longrunning.Operation> + getReviewDocumentMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ReviewDocument", + requestType = com.google.cloud.documentai.v1beta3.ReviewDocumentRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest, + com.google.longrunning.Operation> + getReviewDocumentMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest, + com.google.longrunning.Operation> + getReviewDocumentMethod; + if ((getReviewDocumentMethod = DocumentProcessorServiceGrpc.getReviewDocumentMethod) == null) { + synchronized (DocumentProcessorServiceGrpc.class) { + if ((getReviewDocumentMethod = DocumentProcessorServiceGrpc.getReviewDocumentMethod) + == null) { + DocumentProcessorServiceGrpc.getReviewDocumentMethod = + getReviewDocumentMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ReviewDocument")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new DocumentProcessorServiceMethodDescriptorSupplier("ReviewDocument")) + .build(); + } + } + } + return getReviewDocumentMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static DocumentProcessorServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public DocumentProcessorServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentProcessorServiceStub(channel, callOptions); + } + }; + return DocumentProcessorServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static DocumentProcessorServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public DocumentProcessorServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentProcessorServiceBlockingStub(channel, callOptions); + } + }; + return DocumentProcessorServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static DocumentProcessorServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public DocumentProcessorServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentProcessorServiceFutureStub(channel, callOptions); + } + }; + return DocumentProcessorServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Service to call Cloud DocumentAI to process documents according to the
+   * processor's definition. Processors are built using state-of-the-art Google
+   * AI such as natural language, computer vision, and translation to extract
+   * structured information from unstructured or semi-structured documents.
+   * 
+ */ + public abstract static class DocumentProcessorServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Processes a single document.
+     * 
+ */ + public void processDocument( + com.google.cloud.documentai.v1beta3.ProcessRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getProcessDocumentMethod(), responseObserver); + } + + /** + * + * + *
+     * 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.v1beta3.BatchProcessRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getBatchProcessDocumentsMethod(), responseObserver); + } + + /** + * + * + *
+     * Send a document for Human Review. The input document should be processed by
+     * the specified processor.
+     * 
+ */ + public void reviewDocument( + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getReviewDocumentMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getProcessDocumentMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.documentai.v1beta3.ProcessRequest, + com.google.cloud.documentai.v1beta3.ProcessResponse>( + this, METHODID_PROCESS_DOCUMENT))) + .addMethod( + getBatchProcessDocumentsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.documentai.v1beta3.BatchProcessRequest, + com.google.longrunning.Operation>(this, METHODID_BATCH_PROCESS_DOCUMENTS))) + .addMethod( + getReviewDocumentMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest, + com.google.longrunning.Operation>(this, METHODID_REVIEW_DOCUMENT))) + .build(); + } + } + + /** + * + * + *
+   * Service to call Cloud DocumentAI to process documents according to the
+   * processor's definition. Processors are built using state-of-the-art Google
+   * AI such as natural language, computer vision, and translation to extract
+   * structured information from unstructured or semi-structured documents.
+   * 
+ */ + public static final class DocumentProcessorServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private DocumentProcessorServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DocumentProcessorServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentProcessorServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Processes a single document.
+     * 
+ */ + public void processDocument( + com.google.cloud.documentai.v1beta3.ProcessRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getProcessDocumentMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * 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.v1beta3.BatchProcessRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getBatchProcessDocumentsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Send a document for Human Review. The input document should be processed by
+     * the specified processor.
+     * 
+ */ + public void reviewDocument( + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getReviewDocumentMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service to call Cloud DocumentAI to process documents according to the
+   * processor's definition. Processors are built using state-of-the-art Google
+   * AI such as natural language, computer vision, and translation to extract
+   * structured information from unstructured or semi-structured documents.
+   * 
+ */ + public static final class DocumentProcessorServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private DocumentProcessorServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DocumentProcessorServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentProcessorServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Processes a single document.
+     * 
+ */ + public com.google.cloud.documentai.v1beta3.ProcessResponse processDocument( + com.google.cloud.documentai.v1beta3.ProcessRequest request) { + return blockingUnaryCall(getChannel(), getProcessDocumentMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * 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.v1beta3.BatchProcessRequest request) { + return blockingUnaryCall( + getChannel(), getBatchProcessDocumentsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Send a document for Human Review. The input document should be processed by
+     * the specified processor.
+     * 
+ */ + public com.google.longrunning.Operation reviewDocument( + com.google.cloud.documentai.v1beta3.ReviewDocumentRequest request) { + return blockingUnaryCall(getChannel(), getReviewDocumentMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service to call Cloud DocumentAI to process documents according to the
+   * processor's definition. Processors are built using state-of-the-art Google
+   * AI such as natural language, computer vision, and translation to extract
+   * structured information from unstructured or semi-structured documents.
+   * 
+ */ + public static final class DocumentProcessorServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private DocumentProcessorServiceFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DocumentProcessorServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentProcessorServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Processes a single document.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.documentai.v1beta3.ProcessResponse> + processDocument(com.google.cloud.documentai.v1beta3.ProcessRequest request) { + return futureUnaryCall( + getChannel().newCall(getProcessDocumentMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * 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.v1beta3.BatchProcessRequest request) { + return futureUnaryCall( + getChannel().newCall(getBatchProcessDocumentsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Send a document for Human Review. The input document should be processed by
+     * the specified processor.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + reviewDocument(com.google.cloud.documentai.v1beta3.ReviewDocumentRequest request) { + return futureUnaryCall( + getChannel().newCall(getReviewDocumentMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_PROCESS_DOCUMENT = 0; + private static final int METHODID_BATCH_PROCESS_DOCUMENTS = 1; + private static final int METHODID_REVIEW_DOCUMENT = 2; + + 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 DocumentProcessorServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(DocumentProcessorServiceImplBase 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_PROCESS_DOCUMENT: + serviceImpl.processDocument( + (com.google.cloud.documentai.v1beta3.ProcessRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_BATCH_PROCESS_DOCUMENTS: + serviceImpl.batchProcessDocuments( + (com.google.cloud.documentai.v1beta3.BatchProcessRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_REVIEW_DOCUMENT: + serviceImpl.reviewDocument( + (com.google.cloud.documentai.v1beta3.ReviewDocumentRequest) 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(); + } + } + } + + private abstract static class DocumentProcessorServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + DocumentProcessorServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("DocumentProcessorService"); + } + } + + private static final class DocumentProcessorServiceFileDescriptorSupplier + extends DocumentProcessorServiceBaseDescriptorSupplier { + DocumentProcessorServiceFileDescriptorSupplier() {} + } + + private static final class DocumentProcessorServiceMethodDescriptorSupplier + extends DocumentProcessorServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + DocumentProcessorServiceMethodDescriptorSupplier(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 (DocumentProcessorServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new DocumentProcessorServiceFileDescriptorSupplier()) + .addMethod(getProcessDocumentMethod()) + .addMethod(getBatchProcessDocumentsMethod()) + .addMethod(getReviewDocumentMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 4fcc1269..932d739a 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,11 @@ grpc-google-cloud-document-ai-v1beta2 0.2.5-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-document-ai-v1beta3 + 0.2.5-SNAPSHOT + com.google.api.grpc proto-google-cloud-document-ai-v1beta1 @@ -87,7 +92,11 @@ proto-google-cloud-document-ai-v1beta2 0.2.5-SNAPSHOT - + + com.google.api.grpc + proto-google-cloud-document-ai-v1beta3 + 0.2.5-SNAPSHOT + com.google.cloud @@ -126,8 +135,10 @@ proto-google-cloud-document-ai-v1beta1 proto-google-cloud-document-ai-v1beta2 + proto-google-cloud-document-ai-v1beta3 grpc-google-cloud-document-ai-v1beta1 grpc-google-cloud-document-ai-v1beta2 + grpc-google-cloud-document-ai-v1beta3 google-cloud-document-ai google-cloud-document-ai-bom diff --git a/proto-google-cloud-document-ai-v1beta3/pom.xml b/proto-google-cloud-document-ai-v1beta3/pom.xml new file mode 100644 index 00000000..1cbaecfe --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + com.google.api.grpc + proto-google-cloud-document-ai-v1beta3 + 0.2.5-SNAPSHOT + proto-google-cloud-document-ai-v1beta3 + PROTO library for proto-google-cloud-document-ai-v1beta3 + + com.google.cloud + google-cloud-document-ai-parent + 0.2.5-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.guava + guava + + + com.google.api + api-common + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessMetadata.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessMetadata.java new file mode 100644 index 00000000..19fe24fc --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessMetadata.java @@ -0,0 +1,3650 @@ +/* + * Copyright 2020 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/v1beta3/document_processor_service.proto + +package com.google.cloud.documentai.v1beta3; + +/** + * + * + *
+ * The long running operation metadata for batch process method.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessMetadata} + */ +public final class BatchProcessMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.BatchProcessMetadata) + BatchProcessMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchProcessMetadata.newBuilder() to construct. + private BatchProcessMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchProcessMetadata() { + state_ = 0; + stateMessage_ = ""; + individualProcessStatuses_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchProcessMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchProcessMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + + state_ = rawValue; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + stateMessage_ = s; + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + individualProcessStatuses_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatus>(); + mutable_bitField0_ |= 0x00000001; + } + individualProcessStatuses_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatus.parser(), + extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + individualProcessStatuses_ = + java.util.Collections.unmodifiableList(individualProcessStatuses_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.class, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.Builder.class); + } + + /** + * + * + *
+   * Possible states of the batch processing operation.
+   * 
+ * + * Protobuf enum {@code google.cloud.documentai.v1beta3.BatchProcessMetadata.State} + */ + public enum State implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * The default value. This value is used if the state is omitted.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + STATE_UNSPECIFIED(0), + /** + * + * + *
+     * Request operation is waiting for scheduling.
+     * 
+ * + * WAITING = 1; + */ + WAITING(1), + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 2; + */ + RUNNING(2), + /** + * + * + *
+     * The batch processing completed successfully.
+     * 
+ * + * SUCCEEDED = 3; + */ + SUCCEEDED(3), + /** + * + * + *
+     * The batch processing was being cancelled.
+     * 
+ * + * CANCELLING = 4; + */ + CANCELLING(4), + /** + * + * + *
+     * The batch processing was cancelled.
+     * 
+ * + * CANCELLED = 5; + */ + CANCELLED(5), + /** + * + * + *
+     * The batch processing has failed.
+     * 
+ * + * FAILED = 6; + */ + FAILED(6), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * The default value. This value is used if the state is omitted.
+     * 
+ * + * STATE_UNSPECIFIED = 0; + */ + public static final int STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Request operation is waiting for scheduling.
+     * 
+ * + * WAITING = 1; + */ + public static final int WAITING_VALUE = 1; + /** + * + * + *
+     * Request is being processed.
+     * 
+ * + * RUNNING = 2; + */ + public static final int RUNNING_VALUE = 2; + /** + * + * + *
+     * The batch processing completed successfully.
+     * 
+ * + * SUCCEEDED = 3; + */ + public static final int SUCCEEDED_VALUE = 3; + /** + * + * + *
+     * The batch processing was being cancelled.
+     * 
+ * + * CANCELLING = 4; + */ + public static final int CANCELLING_VALUE = 4; + /** + * + * + *
+     * The batch processing was cancelled.
+     * 
+ * + * CANCELLED = 5; + */ + public static final int CANCELLED_VALUE = 5; + /** + * + * + *
+     * The batch processing has failed.
+     * 
+ * + * FAILED = 6; + */ + public static final int FAILED_VALUE = 6; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static State valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static State forNumber(int value) { + switch (value) { + case 0: + return STATE_UNSPECIFIED; + case 1: + return WAITING; + case 2: + return RUNNING; + case 3: + return SUCCEEDED; + case 4: + return CANCELLING; + case 5: + return CANCELLED; + case 6: + return FAILED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public State findValueByNumber(int number) { + return State.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.BatchProcessMetadata.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final State[] VALUES = values(); + + public static State valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private State(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.documentai.v1beta3.BatchProcessMetadata.State) + } + + public interface IndividualProcessStatusOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The source of the document, same as the [input_gcs_source] field in the
+     * request when the batch process started. The batch process is started by
+     * take snapshot of that document, since a user can move or change that
+     * document during the process.
+     * 
+ * + * string input_gcs_source = 1; + * + * @return The inputGcsSource. + */ + java.lang.String getInputGcsSource(); + /** + * + * + *
+     * The source of the document, same as the [input_gcs_source] field in the
+     * request when the batch process started. The batch process is started by
+     * take snapshot of that document, since a user can move or change that
+     * document during the process.
+     * 
+ * + * string input_gcs_source = 1; + * + * @return The bytes for inputGcsSource. + */ + com.google.protobuf.ByteString getInputGcsSourceBytes(); + + /** + * + * + *
+     * The status of the processing of the document.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + * + * + *
+     * The status of the processing of the document.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return The status. + */ + com.google.rpc.Status getStatus(); + /** + * + * + *
+     * The status of the processing of the document.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + + /** + * + * + *
+     * The output_gcs_destination (in the request as 'output_gcs_destination')
+     * of the processed document if it was successful, otherwise empty.
+     * 
+ * + * string output_gcs_destination = 3; + * + * @return The outputGcsDestination. + */ + java.lang.String getOutputGcsDestination(); + /** + * + * + *
+     * The output_gcs_destination (in the request as 'output_gcs_destination')
+     * of the processed document if it was successful, otherwise empty.
+     * 
+ * + * string output_gcs_destination = 3; + * + * @return The bytes for outputGcsDestination. + */ + com.google.protobuf.ByteString getOutputGcsDestinationBytes(); + + /** + * + * + *
+     * The name of the operation triggered by the processed document. If the
+     * human review process is not triggered, this field will be empty. It has
+     * the same response type and metadata as the long running operation
+     * returned by ReviewDocument method.
+     * 
+ * + * string human_review_operation = 4; + * + * @return The humanReviewOperation. + */ + java.lang.String getHumanReviewOperation(); + /** + * + * + *
+     * The name of the operation triggered by the processed document. If the
+     * human review process is not triggered, this field will be empty. It has
+     * the same response type and metadata as the long running operation
+     * returned by ReviewDocument method.
+     * 
+ * + * string human_review_operation = 4; + * + * @return The bytes for humanReviewOperation. + */ + com.google.protobuf.ByteString getHumanReviewOperationBytes(); + } + /** + * + * + *
+   * The status of a each individual document in the batch process.
+   * 
+ * + * Protobuf type {@code + * google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus} + */ + public static final class IndividualProcessStatus extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + IndividualProcessStatusOrBuilder { + private static final long serialVersionUID = 0L; + // Use IndividualProcessStatus.newBuilder() to construct. + private IndividualProcessStatus(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private IndividualProcessStatus() { + inputGcsSource_ = ""; + outputGcsDestination_ = ""; + humanReviewOperation_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new IndividualProcessStatus(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private IndividualProcessStatus( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + inputGcsSource_ = s; + break; + } + case 18: + { + com.google.rpc.Status.Builder subBuilder = null; + if (status_ != null) { + subBuilder = status_.toBuilder(); + } + status_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(status_); + status_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + outputGcsDestination_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + humanReviewOperation_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_IndividualProcessStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_IndividualProcessStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .class, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .Builder.class); + } + + public static final int INPUT_GCS_SOURCE_FIELD_NUMBER = 1; + private volatile java.lang.Object inputGcsSource_; + /** + * + * + *
+     * The source of the document, same as the [input_gcs_source] field in the
+     * request when the batch process started. The batch process is started by
+     * take snapshot of that document, since a user can move or change that
+     * document during the process.
+     * 
+ * + * string input_gcs_source = 1; + * + * @return The inputGcsSource. + */ + @java.lang.Override + public java.lang.String getInputGcsSource() { + java.lang.Object ref = inputGcsSource_; + 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(); + inputGcsSource_ = s; + return s; + } + } + /** + * + * + *
+     * The source of the document, same as the [input_gcs_source] field in the
+     * request when the batch process started. The batch process is started by
+     * take snapshot of that document, since a user can move or change that
+     * document during the process.
+     * 
+ * + * string input_gcs_source = 1; + * + * @return The bytes for inputGcsSource. + */ + @java.lang.Override + public com.google.protobuf.ByteString getInputGcsSourceBytes() { + java.lang.Object ref = inputGcsSource_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + inputGcsSource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATUS_FIELD_NUMBER = 2; + private com.google.rpc.Status status_; + /** + * + * + *
+     * The status of the processing of the document.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return status_ != null; + } + /** + * + * + *
+     * The status of the processing of the document.
+     * 
+ * + * .google.rpc.Status status = 2; + * + * @return The status. + */ + @java.lang.Override + public com.google.rpc.Status getStatus() { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + /** + * + * + *
+     * The status of the processing of the document.
+     * 
+ * + * .google.rpc.Status status = 2; + */ + @java.lang.Override + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + return getStatus(); + } + + public static final int OUTPUT_GCS_DESTINATION_FIELD_NUMBER = 3; + private volatile java.lang.Object outputGcsDestination_; + /** + * + * + *
+     * The output_gcs_destination (in the request as 'output_gcs_destination')
+     * of the processed document if it was successful, otherwise empty.
+     * 
+ * + * string output_gcs_destination = 3; + * + * @return The outputGcsDestination. + */ + @java.lang.Override + public java.lang.String getOutputGcsDestination() { + java.lang.Object ref = outputGcsDestination_; + 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(); + outputGcsDestination_ = s; + return s; + } + } + /** + * + * + *
+     * The output_gcs_destination (in the request as 'output_gcs_destination')
+     * of the processed document if it was successful, otherwise empty.
+     * 
+ * + * string output_gcs_destination = 3; + * + * @return The bytes for outputGcsDestination. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOutputGcsDestinationBytes() { + java.lang.Object ref = outputGcsDestination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + outputGcsDestination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int HUMAN_REVIEW_OPERATION_FIELD_NUMBER = 4; + private volatile java.lang.Object humanReviewOperation_; + /** + * + * + *
+     * The name of the operation triggered by the processed document. If the
+     * human review process is not triggered, this field will be empty. It has
+     * the same response type and metadata as the long running operation
+     * returned by ReviewDocument method.
+     * 
+ * + * string human_review_operation = 4; + * + * @return The humanReviewOperation. + */ + @java.lang.Override + public java.lang.String getHumanReviewOperation() { + java.lang.Object ref = humanReviewOperation_; + 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(); + humanReviewOperation_ = s; + return s; + } + } + /** + * + * + *
+     * The name of the operation triggered by the processed document. If the
+     * human review process is not triggered, this field will be empty. It has
+     * the same response type and metadata as the long running operation
+     * returned by ReviewDocument method.
+     * 
+ * + * string human_review_operation = 4; + * + * @return The bytes for humanReviewOperation. + */ + @java.lang.Override + public com.google.protobuf.ByteString getHumanReviewOperationBytes() { + java.lang.Object ref = humanReviewOperation_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + humanReviewOperation_ = 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 (!getInputGcsSourceBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, inputGcsSource_); + } + if (status_ != null) { + output.writeMessage(2, getStatus()); + } + if (!getOutputGcsDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, outputGcsDestination_); + } + if (!getHumanReviewOperationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, humanReviewOperation_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getInputGcsSourceBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, inputGcsSource_); + } + if (status_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStatus()); + } + if (!getOutputGcsDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, outputGcsDestination_); + } + if (!getHumanReviewOperationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, humanReviewOperation_); + } + size += unknownFields.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.v1beta3.BatchProcessMetadata.IndividualProcessStatus)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus other = + (com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) obj; + + if (!getInputGcsSource().equals(other.getInputGcsSource())) return false; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus().equals(other.getStatus())) return false; + } + if (!getOutputGcsDestination().equals(other.getOutputGcsDestination())) return false; + if (!getHumanReviewOperation().equals(other.getHumanReviewOperation())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + INPUT_GCS_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getInputGcsSource().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + hash = (37 * hash) + OUTPUT_GCS_DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getOutputGcsDestination().hashCode(); + hash = (37 * hash) + HUMAN_REVIEW_OPERATION_FIELD_NUMBER; + hash = (53 * hash) + getHumanReviewOperation().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + 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.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + 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.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + 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.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + 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.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + 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.v1beta3.BatchProcessMetadata.IndividualProcessStatus + 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; + } + /** + * + * + *
+     * The status of a each individual document in the batch process.
+     * 
+ * + * Protobuf type {@code + * google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatusOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_IndividualProcessStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_IndividualProcessStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .class, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .Builder.class); + } + + // Construct using + // com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + inputGcsSource_ = ""; + + if (statusBuilder_ == null) { + status_ = null; + } else { + status_ = null; + statusBuilder_ = null; + } + outputGcsDestination_ = ""; + + humanReviewOperation_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_IndividualProcessStatus_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + build() { + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + buildPartial() { + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus result = + new com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus( + this); + result.inputGcsSource_ = inputGcsSource_; + if (statusBuilder_ == null) { + result.status_ = status_; + } else { + result.status_ = statusBuilder_.build(); + } + result.outputGcsDestination_ = outputGcsDestination_; + result.humanReviewOperation_ = humanReviewOperation_; + onBuilt(); + return result; + } + + @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.v1beta3.BatchProcessMetadata.IndividualProcessStatus) { + return mergeFrom( + (com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus other) { + if (other + == com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .getDefaultInstance()) return this; + if (!other.getInputGcsSource().isEmpty()) { + inputGcsSource_ = other.inputGcsSource_; + onChanged(); + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + if (!other.getOutputGcsDestination().isEmpty()) { + outputGcsDestination_ = other.outputGcsDestination_; + onChanged(); + } + if (!other.getHumanReviewOperation().isEmpty()) { + humanReviewOperation_ = other.humanReviewOperation_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object inputGcsSource_ = ""; + /** + * + * + *
+       * The source of the document, same as the [input_gcs_source] field in the
+       * request when the batch process started. The batch process is started by
+       * take snapshot of that document, since a user can move or change that
+       * document during the process.
+       * 
+ * + * string input_gcs_source = 1; + * + * @return The inputGcsSource. + */ + public java.lang.String getInputGcsSource() { + java.lang.Object ref = inputGcsSource_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + inputGcsSource_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The source of the document, same as the [input_gcs_source] field in the
+       * request when the batch process started. The batch process is started by
+       * take snapshot of that document, since a user can move or change that
+       * document during the process.
+       * 
+ * + * string input_gcs_source = 1; + * + * @return The bytes for inputGcsSource. + */ + public com.google.protobuf.ByteString getInputGcsSourceBytes() { + java.lang.Object ref = inputGcsSource_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + inputGcsSource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The source of the document, same as the [input_gcs_source] field in the
+       * request when the batch process started. The batch process is started by
+       * take snapshot of that document, since a user can move or change that
+       * document during the process.
+       * 
+ * + * string input_gcs_source = 1; + * + * @param value The inputGcsSource to set. + * @return This builder for chaining. + */ + public Builder setInputGcsSource(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + inputGcsSource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The source of the document, same as the [input_gcs_source] field in the
+       * request when the batch process started. The batch process is started by
+       * take snapshot of that document, since a user can move or change that
+       * document during the process.
+       * 
+ * + * string input_gcs_source = 1; + * + * @return This builder for chaining. + */ + public Builder clearInputGcsSource() { + + inputGcsSource_ = getDefaultInstance().getInputGcsSource(); + onChanged(); + return this; + } + /** + * + * + *
+       * The source of the document, same as the [input_gcs_source] field in the
+       * request when the batch process started. The batch process is started by
+       * take snapshot of that document, since a user can move or change that
+       * document during the process.
+       * 
+ * + * string input_gcs_source = 1; + * + * @param value The bytes for inputGcsSource to set. + * @return This builder for chaining. + */ + public Builder setInputGcsSourceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + inputGcsSource_ = value; + onChanged(); + return this; + } + + private com.google.rpc.Status status_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + statusBuilder_; + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + * + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return statusBuilder_ != null || status_ != null; + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + * + * @return The status. + */ + public com.google.rpc.Status getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder setStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + onChanged(); + } else { + statusBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder setStatus(com.google.rpc.Status.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + onChanged(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder mergeStatus(com.google.rpc.Status value) { + if (statusBuilder_ == null) { + if (status_ != null) { + status_ = com.google.rpc.Status.newBuilder(status_).mergeFrom(value).buildPartial(); + } else { + status_ = value; + } + onChanged(); + } else { + statusBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public Builder clearStatus() { + if (statusBuilder_ == null) { + status_ = null; + onChanged(); + } else { + status_ = null; + statusBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.Status.Builder getStatusBuilder() { + + onChanged(); + return getStatusFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; + } + } + /** + * + * + *
+       * The status of the processing of the document.
+       * 
+ * + * .google.rpc.Status status = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> + getStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.rpc.Status, + com.google.rpc.Status.Builder, + com.google.rpc.StatusOrBuilder>(getStatus(), getParentForChildren(), isClean()); + status_ = null; + } + return statusBuilder_; + } + + private java.lang.Object outputGcsDestination_ = ""; + /** + * + * + *
+       * The output_gcs_destination (in the request as 'output_gcs_destination')
+       * of the processed document if it was successful, otherwise empty.
+       * 
+ * + * string output_gcs_destination = 3; + * + * @return The outputGcsDestination. + */ + public java.lang.String getOutputGcsDestination() { + java.lang.Object ref = outputGcsDestination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + outputGcsDestination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The output_gcs_destination (in the request as 'output_gcs_destination')
+       * of the processed document if it was successful, otherwise empty.
+       * 
+ * + * string output_gcs_destination = 3; + * + * @return The bytes for outputGcsDestination. + */ + public com.google.protobuf.ByteString getOutputGcsDestinationBytes() { + java.lang.Object ref = outputGcsDestination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + outputGcsDestination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The output_gcs_destination (in the request as 'output_gcs_destination')
+       * of the processed document if it was successful, otherwise empty.
+       * 
+ * + * string output_gcs_destination = 3; + * + * @param value The outputGcsDestination to set. + * @return This builder for chaining. + */ + public Builder setOutputGcsDestination(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + outputGcsDestination_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The output_gcs_destination (in the request as 'output_gcs_destination')
+       * of the processed document if it was successful, otherwise empty.
+       * 
+ * + * string output_gcs_destination = 3; + * + * @return This builder for chaining. + */ + public Builder clearOutputGcsDestination() { + + outputGcsDestination_ = getDefaultInstance().getOutputGcsDestination(); + onChanged(); + return this; + } + /** + * + * + *
+       * The output_gcs_destination (in the request as 'output_gcs_destination')
+       * of the processed document if it was successful, otherwise empty.
+       * 
+ * + * string output_gcs_destination = 3; + * + * @param value The bytes for outputGcsDestination to set. + * @return This builder for chaining. + */ + public Builder setOutputGcsDestinationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + outputGcsDestination_ = value; + onChanged(); + return this; + } + + private java.lang.Object humanReviewOperation_ = ""; + /** + * + * + *
+       * The name of the operation triggered by the processed document. If the
+       * human review process is not triggered, this field will be empty. It has
+       * the same response type and metadata as the long running operation
+       * returned by ReviewDocument method.
+       * 
+ * + * string human_review_operation = 4; + * + * @return The humanReviewOperation. + */ + public java.lang.String getHumanReviewOperation() { + java.lang.Object ref = humanReviewOperation_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + humanReviewOperation_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The name of the operation triggered by the processed document. If the
+       * human review process is not triggered, this field will be empty. It has
+       * the same response type and metadata as the long running operation
+       * returned by ReviewDocument method.
+       * 
+ * + * string human_review_operation = 4; + * + * @return The bytes for humanReviewOperation. + */ + public com.google.protobuf.ByteString getHumanReviewOperationBytes() { + java.lang.Object ref = humanReviewOperation_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + humanReviewOperation_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The name of the operation triggered by the processed document. If the
+       * human review process is not triggered, this field will be empty. It has
+       * the same response type and metadata as the long running operation
+       * returned by ReviewDocument method.
+       * 
+ * + * string human_review_operation = 4; + * + * @param value The humanReviewOperation to set. + * @return This builder for chaining. + */ + public Builder setHumanReviewOperation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + humanReviewOperation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The name of the operation triggered by the processed document. If the
+       * human review process is not triggered, this field will be empty. It has
+       * the same response type and metadata as the long running operation
+       * returned by ReviewDocument method.
+       * 
+ * + * string human_review_operation = 4; + * + * @return This builder for chaining. + */ + public Builder clearHumanReviewOperation() { + + humanReviewOperation_ = getDefaultInstance().getHumanReviewOperation(); + onChanged(); + return this; + } + /** + * + * + *
+       * The name of the operation triggered by the processed document. If the
+       * human review process is not triggered, this field will be empty. It has
+       * the same response type and metadata as the long running operation
+       * returned by ReviewDocument method.
+       * 
+ * + * string human_review_operation = 4; + * + * @param value The bytes for humanReviewOperation to set. + * @return This builder for chaining. + */ + public Builder setHumanReviewOperationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + humanReviewOperation_ = value; + 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.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus) + private static final com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatus + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus(); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IndividualProcessStatus parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IndividualProcessStatus(input, extensionRegistry); + } + }; + + 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.v1beta3.BatchProcessMetadata.IndividualProcessStatus + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int STATE_FIELD_NUMBER = 1; + private int state_; + /** + * + * + *
+   * The state of the current batch processing.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * The state of the current batch processing.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State result = + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State.UNRECOGNIZED + : result; + } + + public static final int STATE_MESSAGE_FIELD_NUMBER = 2; + private volatile java.lang.Object stateMessage_; + /** + * + * + *
+   * A message providing more details about the current state of processing.
+   * For example, the error message if the operation is failed.
+   * 
+ * + * string state_message = 2; + * + * @return The stateMessage. + */ + @java.lang.Override + public java.lang.String getStateMessage() { + java.lang.Object ref = stateMessage_; + 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(); + stateMessage_ = s; + return s; + } + } + /** + * + * + *
+   * A message providing more details about the current state of processing.
+   * For example, the error message if the operation is failed.
+   * 
+ * + * string state_message = 2; + * + * @return The bytes for stateMessage. + */ + @java.lang.Override + public com.google.protobuf.ByteString getStateMessageBytes() { + java.lang.Object ref = stateMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + stateMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * The creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3; + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * The creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3; + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * The creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * The last update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * The last update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * The last update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int INDIVIDUAL_PROCESS_STATUSES_FIELD_NUMBER = 5; + private java.util.List< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus> + individualProcessStatuses_; + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + @java.lang.Override + public java.util.List< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus> + getIndividualProcessStatusesList() { + return individualProcessStatuses_; + } + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + @java.lang.Override + public java.util.List< + ? extends + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatusOrBuilder> + getIndividualProcessStatusesOrBuilderList() { + return individualProcessStatuses_; + } + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + @java.lang.Override + public int getIndividualProcessStatusesCount() { + return individualProcessStatuses_.size(); + } + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + getIndividualProcessStatuses(int index) { + return individualProcessStatuses_.get(index); + } + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatusOrBuilder + getIndividualProcessStatusesOrBuilder(int index) { + return individualProcessStatuses_.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 { + if (state_ + != com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (!getStateMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, stateMessage_); + } + if (createTime_ != null) { + output.writeMessage(3, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(4, getUpdateTime()); + } + for (int i = 0; i < individualProcessStatuses_.size(); i++) { + output.writeMessage(5, individualProcessStatuses_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State.STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (!getStateMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, stateMessage_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getUpdateTime()); + } + for (int i = 0; i < individualProcessStatuses_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, individualProcessStatuses_.get(i)); + } + size += unknownFields.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.v1beta3.BatchProcessMetadata)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.BatchProcessMetadata other = + (com.google.cloud.documentai.v1beta3.BatchProcessMetadata) obj; + + if (state_ != other.state_) return false; + if (!getStateMessage().equals(other.getStateMessage())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getIndividualProcessStatusesList().equals(other.getIndividualProcessStatusesList())) + return false; + if (!unknownFields.equals(other.unknownFields)) 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) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + hash = (37 * hash) + STATE_MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getStateMessage().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (getIndividualProcessStatusesCount() > 0) { + hash = (37 * hash) + INDIVIDUAL_PROCESS_STATUSES_FIELD_NUMBER; + hash = (53 * hash) + getIndividualProcessStatusesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata 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.v1beta3.BatchProcessMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata 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.v1beta3.BatchProcessMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata 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.v1beta3.BatchProcessMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata 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.v1beta3.BatchProcessMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata 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.v1beta3.BatchProcessMetadata 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; + } + /** + * + * + *
+   * The long running operation metadata for batch process method.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.BatchProcessMetadata) + com.google.cloud.documentai.v1beta3.BatchProcessMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.class, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta3.BatchProcessMetadata.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getIndividualProcessStatusesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + state_ = 0; + + stateMessage_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (individualProcessStatusesBuilder_ == null) { + individualProcessStatuses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + individualProcessStatusesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.BatchProcessMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata build() { + com.google.cloud.documentai.v1beta3.BatchProcessMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata buildPartial() { + com.google.cloud.documentai.v1beta3.BatchProcessMetadata result = + new com.google.cloud.documentai.v1beta3.BatchProcessMetadata(this); + int from_bitField0_ = bitField0_; + result.state_ = state_; + result.stateMessage_ = stateMessage_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (individualProcessStatusesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + individualProcessStatuses_ = + java.util.Collections.unmodifiableList(individualProcessStatuses_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.individualProcessStatuses_ = individualProcessStatuses_; + } else { + result.individualProcessStatuses_ = individualProcessStatusesBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.v1beta3.BatchProcessMetadata) { + return mergeFrom((com.google.cloud.documentai.v1beta3.BatchProcessMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta3.BatchProcessMetadata other) { + if (other == com.google.cloud.documentai.v1beta3.BatchProcessMetadata.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (!other.getStateMessage().isEmpty()) { + stateMessage_ = other.stateMessage_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (individualProcessStatusesBuilder_ == null) { + if (!other.individualProcessStatuses_.isEmpty()) { + if (individualProcessStatuses_.isEmpty()) { + individualProcessStatuses_ = other.individualProcessStatuses_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.addAll(other.individualProcessStatuses_); + } + onChanged(); + } + } else { + if (!other.individualProcessStatuses_.isEmpty()) { + if (individualProcessStatusesBuilder_.isEmpty()) { + individualProcessStatusesBuilder_.dispose(); + individualProcessStatusesBuilder_ = null; + individualProcessStatuses_ = other.individualProcessStatuses_; + bitField0_ = (bitField0_ & ~0x00000001); + individualProcessStatusesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getIndividualProcessStatusesFieldBuilder() + : null; + } else { + individualProcessStatusesBuilder_.addAllMessages(other.individualProcessStatuses_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.BatchProcessMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.BatchProcessMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private int state_ = 0; + /** + * + * + *
+     * The state of the current batch processing.
+     * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * The state of the current batch processing.
+     * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + + state_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The state of the current batch processing.
+     * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State getState() { + @SuppressWarnings("deprecation") + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State result = + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State.valueOf(state_); + return result == null + ? com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The state of the current batch processing.
+     * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State value) { + if (value == null) { + throw new NullPointerException(); + } + + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The state of the current batch processing.
+     * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @return This builder for chaining. + */ + public Builder clearState() { + + state_ = 0; + onChanged(); + return this; + } + + private java.lang.Object stateMessage_ = ""; + /** + * + * + *
+     * A message providing more details about the current state of processing.
+     * For example, the error message if the operation is failed.
+     * 
+ * + * string state_message = 2; + * + * @return The stateMessage. + */ + public java.lang.String getStateMessage() { + java.lang.Object ref = stateMessage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + stateMessage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A message providing more details about the current state of processing.
+     * For example, the error message if the operation is failed.
+     * 
+ * + * string state_message = 2; + * + * @return The bytes for stateMessage. + */ + public com.google.protobuf.ByteString getStateMessageBytes() { + java.lang.Object ref = stateMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + stateMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A message providing more details about the current state of processing.
+     * For example, the error message if the operation is failed.
+     * 
+ * + * string state_message = 2; + * + * @param value The stateMessage to set. + * @return This builder for chaining. + */ + public Builder setStateMessage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + stateMessage_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A message providing more details about the current state of processing.
+     * For example, the error message if the operation is failed.
+     * 
+ * + * string state_message = 2; + * + * @return This builder for chaining. + */ + public Builder clearStateMessage() { + + stateMessage_ = getDefaultInstance().getStateMessage(); + onChanged(); + return this; + } + /** + * + * + *
+     * A message providing more details about the current state of processing.
+     * For example, the error message if the operation is failed.
+     * 
+ * + * string state_message = 2; + * + * @param value The bytes for stateMessage to set. + * @return This builder for chaining. + */ + public Builder setStateMessageBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + stateMessage_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * The creation time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * The last update time of the operation.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private java.util.List< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus> + individualProcessStatuses_ = java.util.Collections.emptyList(); + + private void ensureIndividualProcessStatusesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + individualProcessStatuses_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus>( + individualProcessStatuses_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .Builder, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatusOrBuilder> + individualProcessStatusesBuilder_; + + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public java.util.List< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus> + getIndividualProcessStatusesList() { + if (individualProcessStatusesBuilder_ == null) { + return java.util.Collections.unmodifiableList(individualProcessStatuses_); + } else { + return individualProcessStatusesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public int getIndividualProcessStatusesCount() { + if (individualProcessStatusesBuilder_ == null) { + return individualProcessStatuses_.size(); + } else { + return individualProcessStatusesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + getIndividualProcessStatuses(int index) { + if (individualProcessStatusesBuilder_ == null) { + return individualProcessStatuses_.get(index); + } else { + return individualProcessStatusesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder setIndividualProcessStatuses( + int index, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus value) { + if (individualProcessStatusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.set(index, value); + onChanged(); + } else { + individualProcessStatusesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder setIndividualProcessStatuses( + int index, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.Builder + builderForValue) { + if (individualProcessStatusesBuilder_ == null) { + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.set(index, builderForValue.build()); + onChanged(); + } else { + individualProcessStatusesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder addIndividualProcessStatuses( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus value) { + if (individualProcessStatusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.add(value); + onChanged(); + } else { + individualProcessStatusesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder addIndividualProcessStatuses( + int index, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus value) { + if (individualProcessStatusesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.add(index, value); + onChanged(); + } else { + individualProcessStatusesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder addIndividualProcessStatuses( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.Builder + builderForValue) { + if (individualProcessStatusesBuilder_ == null) { + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.add(builderForValue.build()); + onChanged(); + } else { + individualProcessStatusesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder addIndividualProcessStatuses( + int index, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.Builder + builderForValue) { + if (individualProcessStatusesBuilder_ == null) { + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.add(index, builderForValue.build()); + onChanged(); + } else { + individualProcessStatusesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder addAllIndividualProcessStatuses( + java.lang.Iterable< + ? extends + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatus> + values) { + if (individualProcessStatusesBuilder_ == null) { + ensureIndividualProcessStatusesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, individualProcessStatuses_); + onChanged(); + } else { + individualProcessStatusesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder clearIndividualProcessStatuses() { + if (individualProcessStatusesBuilder_ == null) { + individualProcessStatuses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + individualProcessStatusesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public Builder removeIndividualProcessStatuses(int index) { + if (individualProcessStatusesBuilder_ == null) { + ensureIndividualProcessStatusesIsMutable(); + individualProcessStatuses_.remove(index); + onChanged(); + } else { + individualProcessStatusesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.Builder + getIndividualProcessStatusesBuilder(int index) { + return getIndividualProcessStatusesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatusOrBuilder + getIndividualProcessStatusesOrBuilder(int index) { + if (individualProcessStatusesBuilder_ == null) { + return individualProcessStatuses_.get(index); + } else { + return individualProcessStatusesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public java.util.List< + ? extends + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatusOrBuilder> + getIndividualProcessStatusesOrBuilderList() { + if (individualProcessStatusesBuilder_ != null) { + return individualProcessStatusesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(individualProcessStatuses_); + } + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.Builder + addIndividualProcessStatusesBuilder() { + return getIndividualProcessStatusesFieldBuilder() + .addBuilder( + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .getDefaultInstance()); + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus.Builder + addIndividualProcessStatusesBuilder(int index) { + return getIndividualProcessStatusesFieldBuilder() + .addBuilder( + index, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .getDefaultInstance()); + } + /** + * + * + *
+     * The list of response details of each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + public java.util.List< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .Builder> + getIndividualProcessStatusesBuilderList() { + return getIndividualProcessStatusesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .Builder, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatusOrBuilder> + getIndividualProcessStatusesFieldBuilder() { + if (individualProcessStatusesBuilder_ == null) { + individualProcessStatusesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + .Builder, + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatusOrBuilder>( + individualProcessStatuses_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + individualProcessStatuses_ = null; + } + return individualProcessStatusesBuilder_; + } + + @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.v1beta3.BatchProcessMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.BatchProcessMetadata) + private static final com.google.cloud.documentai.v1beta3.BatchProcessMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta3.BatchProcessMetadata(); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchProcessMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchProcessMetadata(input, extensionRegistry); + } + }; + + 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.v1beta3.BatchProcessMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessMetadataOrBuilder.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessMetadataOrBuilder.java new file mode 100644 index 00000000..66551649 --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessMetadataOrBuilder.java @@ -0,0 +1,215 @@ +/* + * Copyright 2020 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/v1beta3/document_processor_service.proto + +package com.google.cloud.documentai.v1beta3; + +public interface BatchProcessMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.BatchProcessMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The state of the current batch processing.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * The state of the current batch processing.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessMetadata.State state = 1; + * + * @return The state. + */ + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.State getState(); + + /** + * + * + *
+   * A message providing more details about the current state of processing.
+   * For example, the error message if the operation is failed.
+   * 
+ * + * string state_message = 2; + * + * @return The stateMessage. + */ + java.lang.String getStateMessage(); + /** + * + * + *
+   * A message providing more details about the current state of processing.
+   * For example, the error message if the operation is failed.
+   * 
+ * + * string state_message = 2; + * + * @return The bytes for stateMessage. + */ + com.google.protobuf.ByteString getStateMessageBytes(); + + /** + * + * + *
+   * The creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3; + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * The creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3; + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * The creation time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * The last update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * The last update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * The last update time of the operation.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + java.util.List + getIndividualProcessStatusesList(); + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus + getIndividualProcessStatuses(int index); + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + int getIndividualProcessStatusesCount(); + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + java.util.List< + ? extends + com.google.cloud.documentai.v1beta3.BatchProcessMetadata + .IndividualProcessStatusOrBuilder> + getIndividualProcessStatusesOrBuilderList(); + /** + * + * + *
+   * The list of response details of each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatus individual_process_statuses = 5; + * + */ + com.google.cloud.documentai.v1beta3.BatchProcessMetadata.IndividualProcessStatusOrBuilder + getIndividualProcessStatusesOrBuilder(int index); +} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessRequest.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessRequest.java new file mode 100644 index 00000000..32095281 --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessRequest.java @@ -0,0 +1,3117 @@ +/* + * Copyright 2020 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/v1beta3/document_processor_service.proto + +package com.google.cloud.documentai.v1beta3; + +/** + * + * + *
+ * Request message for batch process document method.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessRequest} + */ +public final class BatchProcessRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.BatchProcessRequest) + BatchProcessRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchProcessRequest.newBuilder() to construct. + private BatchProcessRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchProcessRequest() { + name_ = ""; + inputConfigs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchProcessRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchProcessRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + inputConfigs_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig>(); + mutable_bitField0_ |= 0x00000001; + } + inputConfigs_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + .parser(), + extensionRegistry)); + break; + } + case 26: + { + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder + subBuilder = null; + if (outputConfig_ != null) { + subBuilder = outputConfig_.toBuilder(); + } + outputConfig_ = + input.readMessage( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + .parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(outputConfig_); + outputConfig_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + inputConfigs_ = java.util.Collections.unmodifiableList(inputConfigs_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.class, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.Builder.class); + } + + public interface BatchInputConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The Cloud Storage location as the source of the document.
+     * 
+ * + * string gcs_source = 1; + * + * @return The gcsSource. + */ + java.lang.String getGcsSource(); + /** + * + * + *
+     * The Cloud Storage location as the source of the document.
+     * 
+ * + * string gcs_source = 1; + * + * @return The bytes for gcsSource. + */ + com.google.protobuf.ByteString getGcsSourceBytes(); + + /** + * + * + *
+     * Mimetype of the input. If the input is a raw document, the supported
+     * mimetypes are application/pdf, image/tiff, and image/gif.
+     * If the input is a [Document] proto, the type should be application/json.
+     * 
+ * + * string mime_type = 2; + * + * @return The mimeType. + */ + java.lang.String getMimeType(); + /** + * + * + *
+     * Mimetype of the input. If the input is a raw document, the supported
+     * mimetypes are application/pdf, image/tiff, and image/gif.
+     * If the input is a [Document] proto, the type should be application/json.
+     * 
+ * + * string mime_type = 2; + * + * @return The bytes for mimeType. + */ + com.google.protobuf.ByteString getMimeTypeBytes(); + } + /** + * + * + *
+   * The message for input config in batch process.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig} + */ + public static final class BatchInputConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) + BatchInputConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchInputConfig.newBuilder() to construct. + private BatchInputConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchInputConfig() { + gcsSource_ = ""; + mimeType_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchInputConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchInputConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + gcsSource_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + mimeType_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.class, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + .class); + } + + public static final int GCS_SOURCE_FIELD_NUMBER = 1; + private volatile java.lang.Object gcsSource_; + /** + * + * + *
+     * The Cloud Storage location as the source of the document.
+     * 
+ * + * string gcs_source = 1; + * + * @return The gcsSource. + */ + @java.lang.Override + public java.lang.String getGcsSource() { + java.lang.Object ref = gcsSource_; + 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(); + gcsSource_ = s; + return s; + } + } + /** + * + * + *
+     * The Cloud Storage location as the source of the document.
+     * 
+ * + * string gcs_source = 1; + * + * @return The bytes for gcsSource. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcsSourceBytes() { + java.lang.Object ref = gcsSource_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcsSource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MIME_TYPE_FIELD_NUMBER = 2; + private volatile java.lang.Object mimeType_; + /** + * + * + *
+     * Mimetype of the input. If the input is a raw document, the supported
+     * mimetypes are application/pdf, image/tiff, and image/gif.
+     * If the input is a [Document] proto, the type should be application/json.
+     * 
+ * + * string mime_type = 2; + * + * @return The mimeType. + */ + @java.lang.Override + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + 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(); + mimeType_ = s; + return s; + } + } + /** + * + * + *
+     * Mimetype of the input. If the input is a raw document, the supported
+     * mimetypes are application/pdf, image/tiff, and image/gif.
+     * If the input is a [Document] proto, the type should be application/json.
+     * 
+ * + * string mime_type = 2; + * + * @return The bytes for mimeType. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = 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 (!getGcsSourceBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, gcsSource_); + } + if (!getMimeTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, mimeType_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getGcsSourceBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, gcsSource_); + } + if (!getMimeTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, mimeType_); + } + size += unknownFields.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.v1beta3.BatchProcessRequest.BatchInputConfig)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig other = + (com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) obj; + + if (!getGcsSource().equals(other.getGcsSource())) return false; + if (!getMimeType().equals(other.getMimeType())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + GCS_SOURCE_FIELD_NUMBER; + hash = (53 * hash) + getGcsSource().hashCode(); + hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMimeType().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + 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.v1beta3.BatchProcessRequest.BatchInputConfig + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + 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.v1beta3.BatchProcessRequest.BatchInputConfig + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + 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.v1beta3.BatchProcessRequest.BatchInputConfig + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + 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.v1beta3.BatchProcessRequest.BatchInputConfig + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + 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.v1beta3.BatchProcessRequest.BatchInputConfig 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; + } + /** + * + * + *
+     * The message for input config in batch process.
+     * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchInputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchInputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.class, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + .class); + } + + // Construct using + // com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + gcsSource_ = ""; + + mimeType_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchInputConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig build() { + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + buildPartial() { + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig result = + new com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig(this); + result.gcsSource_ = gcsSource_; + result.mimeType_ = mimeType_; + onBuilt(); + return result; + } + + @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.v1beta3.BatchProcessRequest.BatchInputConfig) { + return mergeFrom( + (com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig other) { + if (other + == com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + .getDefaultInstance()) return this; + if (!other.getGcsSource().isEmpty()) { + gcsSource_ = other.gcsSource_; + onChanged(); + } + if (!other.getMimeType().isEmpty()) { + mimeType_ = other.mimeType_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig parsedMessage = + null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object gcsSource_ = ""; + /** + * + * + *
+       * The Cloud Storage location as the source of the document.
+       * 
+ * + * string gcs_source = 1; + * + * @return The gcsSource. + */ + public java.lang.String getGcsSource() { + java.lang.Object ref = gcsSource_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcsSource_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The Cloud Storage location as the source of the document.
+       * 
+ * + * string gcs_source = 1; + * + * @return The bytes for gcsSource. + */ + public com.google.protobuf.ByteString getGcsSourceBytes() { + java.lang.Object ref = gcsSource_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcsSource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The Cloud Storage location as the source of the document.
+       * 
+ * + * string gcs_source = 1; + * + * @param value The gcsSource to set. + * @return This builder for chaining. + */ + public Builder setGcsSource(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + gcsSource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The Cloud Storage location as the source of the document.
+       * 
+ * + * string gcs_source = 1; + * + * @return This builder for chaining. + */ + public Builder clearGcsSource() { + + gcsSource_ = getDefaultInstance().getGcsSource(); + onChanged(); + return this; + } + /** + * + * + *
+       * The Cloud Storage location as the source of the document.
+       * 
+ * + * string gcs_source = 1; + * + * @param value The bytes for gcsSource to set. + * @return This builder for chaining. + */ + public Builder setGcsSourceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + gcsSource_ = value; + onChanged(); + return this; + } + + private java.lang.Object mimeType_ = ""; + /** + * + * + *
+       * Mimetype of the input. If the input is a raw document, the supported
+       * mimetypes are application/pdf, image/tiff, and image/gif.
+       * If the input is a [Document] proto, the type should be application/json.
+       * 
+ * + * string mime_type = 2; + * + * @return The mimeType. + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Mimetype of the input. If the input is a raw document, the supported
+       * mimetypes are application/pdf, image/tiff, and image/gif.
+       * If the input is a [Document] proto, the type should be application/json.
+       * 
+ * + * string mime_type = 2; + * + * @return The bytes for mimeType. + */ + public com.google.protobuf.ByteString getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Mimetype of the input. If the input is a raw document, the supported
+       * mimetypes are application/pdf, image/tiff, and image/gif.
+       * If the input is a [Document] proto, the type should be application/json.
+       * 
+ * + * string mime_type = 2; + * + * @param value The mimeType to set. + * @return This builder for chaining. + */ + public Builder setMimeType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + mimeType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Mimetype of the input. If the input is a raw document, the supported
+       * mimetypes are application/pdf, image/tiff, and image/gif.
+       * If the input is a [Document] proto, the type should be application/json.
+       * 
+ * + * string mime_type = 2; + * + * @return This builder for chaining. + */ + public Builder clearMimeType() { + + mimeType_ = getDefaultInstance().getMimeType(); + onChanged(); + return this; + } + /** + * + * + *
+       * Mimetype of the input. If the input is a raw document, the supported
+       * mimetypes are application/pdf, image/tiff, and image/gif.
+       * If the input is a [Document] proto, the type should be application/json.
+       * 
+ * + * string mime_type = 2; + * + * @param value The bytes for mimeType to set. + * @return This builder for chaining. + */ + public Builder setMimeTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + mimeType_ = value; + 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.v1beta3.BatchProcessRequest.BatchInputConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig) + private static final com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig(); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchInputConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchInputConfig(input, extensionRegistry); + } + }; + + 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.v1beta3.BatchProcessRequest.BatchInputConfig + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface BatchOutputConfigOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The output Cloud Storage directory to put the processed documents.
+     * 
+ * + * string gcs_destination = 1; + * + * @return The gcsDestination. + */ + java.lang.String getGcsDestination(); + /** + * + * + *
+     * The output Cloud Storage directory to put the processed documents.
+     * 
+ * + * string gcs_destination = 1; + * + * @return The bytes for gcsDestination. + */ + com.google.protobuf.ByteString getGcsDestinationBytes(); + } + /** + * + * + *
+   * The message for output config in batch process.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} + */ + public static final class BatchOutputConfig extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) + BatchOutputConfigOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchOutputConfig.newBuilder() to construct. + private BatchOutputConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchOutputConfig() { + gcsDestination_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchOutputConfig(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchOutputConfig( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + gcsDestination_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchOutputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchOutputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.class, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder + .class); + } + + public static final int GCS_DESTINATION_FIELD_NUMBER = 1; + private volatile java.lang.Object gcsDestination_; + /** + * + * + *
+     * The output Cloud Storage directory to put the processed documents.
+     * 
+ * + * string gcs_destination = 1; + * + * @return The gcsDestination. + */ + @java.lang.Override + public java.lang.String getGcsDestination() { + java.lang.Object ref = gcsDestination_; + 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(); + gcsDestination_ = s; + return s; + } + } + /** + * + * + *
+     * The output Cloud Storage directory to put the processed documents.
+     * 
+ * + * string gcs_destination = 1; + * + * @return The bytes for gcsDestination. + */ + @java.lang.Override + public com.google.protobuf.ByteString getGcsDestinationBytes() { + java.lang.Object ref = gcsDestination_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcsDestination_ = 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 (!getGcsDestinationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, gcsDestination_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getGcsDestinationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, gcsDestination_); + } + size += unknownFields.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.v1beta3.BatchProcessRequest.BatchOutputConfig)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig other = + (com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) obj; + + if (!getGcsDestination().equals(other.getGcsDestination())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + GCS_DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getGcsDestination().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + 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.v1beta3.BatchProcessRequest.BatchOutputConfig + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + 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.v1beta3.BatchProcessRequest.BatchOutputConfig + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + 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.v1beta3.BatchProcessRequest.BatchOutputConfig + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + 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.v1beta3.BatchProcessRequest.BatchOutputConfig + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + 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.v1beta3.BatchProcessRequest.BatchOutputConfig 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; + } + /** + * + * + *
+     * The message for output config in batch process.
+     * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchOutputConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchOutputConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.class, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder + .class); + } + + // Construct using + // com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + gcsDestination_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_BatchOutputConfig_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig build() { + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + buildPartial() { + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig result = + new com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig(this); + result.gcsDestination_ = gcsDestination_; + onBuilt(); + return result; + } + + @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.v1beta3.BatchProcessRequest.BatchOutputConfig) { + return mergeFrom( + (com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig other) { + if (other + == com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + .getDefaultInstance()) return this; + if (!other.getGcsDestination().isEmpty()) { + gcsDestination_ = other.gcsDestination_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig parsedMessage = + null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object gcsDestination_ = ""; + /** + * + * + *
+       * The output Cloud Storage directory to put the processed documents.
+       * 
+ * + * string gcs_destination = 1; + * + * @return The gcsDestination. + */ + public java.lang.String getGcsDestination() { + java.lang.Object ref = gcsDestination_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + gcsDestination_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * The output Cloud Storage directory to put the processed documents.
+       * 
+ * + * string gcs_destination = 1; + * + * @return The bytes for gcsDestination. + */ + public com.google.protobuf.ByteString getGcsDestinationBytes() { + java.lang.Object ref = gcsDestination_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + gcsDestination_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * The output Cloud Storage directory to put the processed documents.
+       * 
+ * + * string gcs_destination = 1; + * + * @param value The gcsDestination to set. + * @return This builder for chaining. + */ + public Builder setGcsDestination(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + gcsDestination_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The output Cloud Storage directory to put the processed documents.
+       * 
+ * + * string gcs_destination = 1; + * + * @return This builder for chaining. + */ + public Builder clearGcsDestination() { + + gcsDestination_ = getDefaultInstance().getGcsDestination(); + onChanged(); + return this; + } + /** + * + * + *
+       * The output Cloud Storage directory to put the processed documents.
+       * 
+ * + * string gcs_destination = 1; + * + * @param value The bytes for gcsDestination to set. + * @return This builder for chaining. + */ + public Builder setGcsDestinationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + gcsDestination_ = value; + 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.v1beta3.BatchProcessRequest.BatchOutputConfig) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig) + private static final com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig(); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchOutputConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchOutputConfig(input, extensionRegistry); + } + }; + + 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.v1beta3.BatchProcessRequest.BatchOutputConfig + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The processor resource name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + 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(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The processor resource name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUT_CONFIGS_FIELD_NUMBER = 2; + private java.util.List + inputConfigs_; + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + @java.lang.Override + public java.util.List + getInputConfigsList() { + return inputConfigs_; + } + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + @java.lang.Override + public java.util.List< + ? extends + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder> + getInputConfigsOrBuilderList() { + return inputConfigs_; + } + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + @java.lang.Override + public int getInputConfigsCount() { + return inputConfigs_.size(); + } + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig getInputConfigs( + int index) { + return inputConfigs_.get(index); + } + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder + getInputConfigsOrBuilder(int index) { + return inputConfigs_.get(index); + } + + public static final int OUTPUT_CONFIG_FIELD_NUMBER = 3; + private com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig outputConfig_; + /** + * + * + *
+   * The overall output config for batch process.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + * + * @return Whether the outputConfig field is set. + */ + @java.lang.Override + public boolean hasOutputConfig() { + return outputConfig_ != null; + } + /** + * + * + *
+   * The overall output config for batch process.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + * + * @return The outputConfig. + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + getOutputConfig() { + return outputConfig_ == null + ? com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + .getDefaultInstance() + : outputConfig_; + } + /** + * + * + *
+   * The overall output config for batch process.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfigOrBuilder + getOutputConfigOrBuilder() { + return getOutputConfig(); + } + + 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 (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + for (int i = 0; i < inputConfigs_.size(); i++) { + output.writeMessage(2, inputConfigs_.get(i)); + } + if (outputConfig_ != null) { + output.writeMessage(3, getOutputConfig()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + for (int i = 0; i < inputConfigs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, inputConfigs_.get(i)); + } + if (outputConfig_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getOutputConfig()); + } + size += unknownFields.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.v1beta3.BatchProcessRequest)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.BatchProcessRequest other = + (com.google.cloud.documentai.v1beta3.BatchProcessRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getInputConfigsList().equals(other.getInputConfigsList())) return false; + if (hasOutputConfig() != other.hasOutputConfig()) return false; + if (hasOutputConfig()) { + if (!getOutputConfig().equals(other.getOutputConfig())) return false; + } + if (!unknownFields.equals(other.unknownFields)) 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) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (getInputConfigsCount() > 0) { + hash = (37 * hash) + INPUT_CONFIGS_FIELD_NUMBER; + hash = (53 * hash) + getInputConfigsList().hashCode(); + } + if (hasOutputConfig()) { + hash = (37 * hash) + OUTPUT_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getOutputConfig().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest 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.v1beta3.BatchProcessRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest 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.v1beta3.BatchProcessRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest 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.v1beta3.BatchProcessRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest 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.v1beta3.BatchProcessRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest 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.v1beta3.BatchProcessRequest 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 message for batch process document method.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.BatchProcessRequest) + com.google.cloud.documentai.v1beta3.BatchProcessRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.class, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta3.BatchProcessRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getInputConfigsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + if (inputConfigsBuilder_ == null) { + inputConfigs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + inputConfigsBuilder_.clear(); + } + if (outputConfigBuilder_ == null) { + outputConfig_ = null; + } else { + outputConfig_ = null; + outputConfigBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.BatchProcessRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest build() { + com.google.cloud.documentai.v1beta3.BatchProcessRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessRequest buildPartial() { + com.google.cloud.documentai.v1beta3.BatchProcessRequest result = + new com.google.cloud.documentai.v1beta3.BatchProcessRequest(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + if (inputConfigsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + inputConfigs_ = java.util.Collections.unmodifiableList(inputConfigs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.inputConfigs_ = inputConfigs_; + } else { + result.inputConfigs_ = inputConfigsBuilder_.build(); + } + if (outputConfigBuilder_ == null) { + result.outputConfig_ = outputConfig_; + } else { + result.outputConfig_ = outputConfigBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.v1beta3.BatchProcessRequest) { + return mergeFrom((com.google.cloud.documentai.v1beta3.BatchProcessRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta3.BatchProcessRequest other) { + if (other == com.google.cloud.documentai.v1beta3.BatchProcessRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (inputConfigsBuilder_ == null) { + if (!other.inputConfigs_.isEmpty()) { + if (inputConfigs_.isEmpty()) { + inputConfigs_ = other.inputConfigs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureInputConfigsIsMutable(); + inputConfigs_.addAll(other.inputConfigs_); + } + onChanged(); + } + } else { + if (!other.inputConfigs_.isEmpty()) { + if (inputConfigsBuilder_.isEmpty()) { + inputConfigsBuilder_.dispose(); + inputConfigsBuilder_ = null; + inputConfigs_ = other.inputConfigs_; + bitField0_ = (bitField0_ & ~0x00000001); + inputConfigsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getInputConfigsFieldBuilder() + : null; + } else { + inputConfigsBuilder_.addAllMessages(other.inputConfigs_); + } + } + } + if (other.hasOutputConfig()) { + mergeOutputConfig(other.getOutputConfig()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.BatchProcessRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.BatchProcessRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The processor resource name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The processor resource name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The processor resource name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The processor resource name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The processor resource name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.util.List + inputConfigs_ = java.util.Collections.emptyList(); + + private void ensureInputConfigsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + inputConfigs_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig>( + inputConfigs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder> + inputConfigsBuilder_; + + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public java.util.List + getInputConfigsList() { + if (inputConfigsBuilder_ == null) { + return java.util.Collections.unmodifiableList(inputConfigs_); + } else { + return inputConfigsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public int getInputConfigsCount() { + if (inputConfigsBuilder_ == null) { + return inputConfigs_.size(); + } else { + return inputConfigsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig getInputConfigs( + int index) { + if (inputConfigsBuilder_ == null) { + return inputConfigs_.get(index); + } else { + return inputConfigsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder setInputConfigs( + int index, com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig value) { + if (inputConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputConfigsIsMutable(); + inputConfigs_.set(index, value); + onChanged(); + } else { + inputConfigsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder setInputConfigs( + int index, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + builderForValue) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.set(index, builderForValue.build()); + onChanged(); + } else { + inputConfigsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder addInputConfigs( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig value) { + if (inputConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputConfigsIsMutable(); + inputConfigs_.add(value); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder addInputConfigs( + int index, com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig value) { + if (inputConfigsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputConfigsIsMutable(); + inputConfigs_.add(index, value); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder addInputConfigs( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + builderForValue) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.add(builderForValue.build()); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder addInputConfigs( + int index, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + builderForValue) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.add(index, builderForValue.build()); + onChanged(); + } else { + inputConfigsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder addAllInputConfigs( + java.lang.Iterable< + ? extends com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig> + values) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, inputConfigs_); + onChanged(); + } else { + inputConfigsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder clearInputConfigs() { + if (inputConfigsBuilder_ == null) { + inputConfigs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + inputConfigsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public Builder removeInputConfigs(int index) { + if (inputConfigsBuilder_ == null) { + ensureInputConfigsIsMutable(); + inputConfigs_.remove(index); + onChanged(); + } else { + inputConfigsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + getInputConfigsBuilder(int index) { + return getInputConfigsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder + getInputConfigsOrBuilder(int index) { + if (inputConfigsBuilder_ == null) { + return inputConfigs_.get(index); + } else { + return inputConfigsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public java.util.List< + ? extends + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder> + getInputConfigsOrBuilderList() { + if (inputConfigsBuilder_ != null) { + return inputConfigsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(inputConfigs_); + } + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + addInputConfigsBuilder() { + return getInputConfigsFieldBuilder() + .addBuilder( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + .getDefaultInstance()); + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder + addInputConfigsBuilder(int index) { + return getInputConfigsFieldBuilder() + .addBuilder( + index, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig + .getDefaultInstance()); + } + /** + * + * + *
+     * The input config for each single document in the batch process.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + public java.util.List< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder> + getInputConfigsBuilderList() { + return getInputConfigsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder> + getInputConfigsFieldBuilder() { + if (inputConfigsBuilder_ == null) { + inputConfigsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig.Builder, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder>( + inputConfigs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + inputConfigs_ = null; + } + return inputConfigsBuilder_; + } + + private com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig outputConfig_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfigOrBuilder> + outputConfigBuilder_; + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + * + * @return Whether the outputConfig field is set. + */ + public boolean hasOutputConfig() { + return outputConfigBuilder_ != null || outputConfig_ != null; + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + * + * @return The outputConfig. + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + getOutputConfig() { + if (outputConfigBuilder_ == null) { + return outputConfig_ == null + ? com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + .getDefaultInstance() + : outputConfig_; + } else { + return outputConfigBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + public Builder setOutputConfig( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig value) { + if (outputConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + outputConfig_ = value; + onChanged(); + } else { + outputConfigBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + public Builder setOutputConfig( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder + builderForValue) { + if (outputConfigBuilder_ == null) { + outputConfig_ = builderForValue.build(); + onChanged(); + } else { + outputConfigBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + public Builder mergeOutputConfig( + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig value) { + if (outputConfigBuilder_ == null) { + if (outputConfig_ != null) { + outputConfig_ = + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.newBuilder( + outputConfig_) + .mergeFrom(value) + .buildPartial(); + } else { + outputConfig_ = value; + } + onChanged(); + } else { + outputConfigBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + public Builder clearOutputConfig() { + if (outputConfigBuilder_ == null) { + outputConfig_ = null; + onChanged(); + } else { + outputConfig_ = null; + outputConfigBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder + getOutputConfigBuilder() { + + onChanged(); + return getOutputConfigFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + public com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfigOrBuilder + getOutputConfigOrBuilder() { + if (outputConfigBuilder_ != null) { + return outputConfigBuilder_.getMessageOrBuilder(); + } else { + return outputConfig_ == null + ? com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig + .getDefaultInstance() + : outputConfig_; + } + } + /** + * + * + *
+     * The overall output config for batch process.
+     * 
+ * + * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfigOrBuilder> + getOutputConfigFieldBuilder() { + if (outputConfigBuilder_ == null) { + outputConfigBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig.Builder, + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfigOrBuilder>( + getOutputConfig(), getParentForChildren(), isClean()); + outputConfig_ = null; + } + return outputConfigBuilder_; + } + + @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.v1beta3.BatchProcessRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.BatchProcessRequest) + private static final com.google.cloud.documentai.v1beta3.BatchProcessRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta3.BatchProcessRequest(); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchProcessRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchProcessRequest(input, extensionRegistry); + } + }; + + 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.v1beta3.BatchProcessRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessRequestOrBuilder.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessRequestOrBuilder.java new file mode 100644 index 00000000..78b12577 --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessRequestOrBuilder.java @@ -0,0 +1,160 @@ +/* + * Copyright 2020 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/v1beta3/document_processor_service.proto + +package com.google.cloud.documentai.v1beta3; + +public interface BatchProcessRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.BatchProcessRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The processor resource name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The processor resource name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + java.util.List + getInputConfigsList(); + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig getInputConfigs( + int index); + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + int getInputConfigsCount(); + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + java.util.List< + ? extends + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder> + getInputConfigsOrBuilderList(); + /** + * + * + *
+   * The input config for each single document in the batch process.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfig input_configs = 2; + * + */ + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchInputConfigOrBuilder + getInputConfigsOrBuilder(int index); + + /** + * + * + *
+   * The overall output config for batch process.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + * + * @return Whether the outputConfig field is set. + */ + boolean hasOutputConfig(); + /** + * + * + *
+   * The overall output config for batch process.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + * + * @return The outputConfig. + */ + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig getOutputConfig(); + /** + * + * + *
+   * The overall output config for batch process.
+   * 
+ * + * .google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfig output_config = 3; + * + */ + com.google.cloud.documentai.v1beta3.BatchProcessRequest.BatchOutputConfigOrBuilder + getOutputConfigOrBuilder(); +} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessResponse.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessResponse.java new file mode 100644 index 00000000..c3b019cf --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessResponse.java @@ -0,0 +1,457 @@ +/* + * Copyright 2020 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/v1beta3/document_processor_service.proto + +package com.google.cloud.documentai.v1beta3; + +/** + * + * + *
+ * Response message for batch process document method.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessResponse} + */ +public final class BatchProcessResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.BatchProcessResponse) + BatchProcessResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchProcessResponse.newBuilder() to construct. + private BatchProcessResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchProcessResponse() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BatchProcessResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchProcessResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessResponse.class, + com.google.cloud.documentai.v1beta3.BatchProcessResponse.Builder.class); + } + + 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 { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.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.v1beta3.BatchProcessResponse)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.BatchProcessResponse other = + (com.google.cloud.documentai.v1beta3.BatchProcessResponse) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse 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.v1beta3.BatchProcessResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse 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.v1beta3.BatchProcessResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse 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.v1beta3.BatchProcessResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse 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.v1beta3.BatchProcessResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse 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.v1beta3.BatchProcessResponse 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 message for batch process document method.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BatchProcessResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.BatchProcessResponse) + com.google.cloud.documentai.v1beta3.BatchProcessResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BatchProcessResponse.class, + com.google.cloud.documentai.v1beta3.BatchProcessResponse.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta3.BatchProcessResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentAiProcessorService + .internal_static_google_cloud_documentai_v1beta3_BatchProcessResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessResponse getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.BatchProcessResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessResponse build() { + com.google.cloud.documentai.v1beta3.BatchProcessResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BatchProcessResponse buildPartial() { + com.google.cloud.documentai.v1beta3.BatchProcessResponse result = + new com.google.cloud.documentai.v1beta3.BatchProcessResponse(this); + onBuilt(); + return result; + } + + @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.v1beta3.BatchProcessResponse) { + return mergeFrom((com.google.cloud.documentai.v1beta3.BatchProcessResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta3.BatchProcessResponse other) { + if (other == com.google.cloud.documentai.v1beta3.BatchProcessResponse.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.BatchProcessResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.BatchProcessResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + 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.v1beta3.BatchProcessResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.BatchProcessResponse) + private static final com.google.cloud.documentai.v1beta3.BatchProcessResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta3.BatchProcessResponse(); + } + + public static com.google.cloud.documentai.v1beta3.BatchProcessResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchProcessResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchProcessResponse(input, extensionRegistry); + } + }; + + 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.v1beta3.BatchProcessResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessResponseOrBuilder.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessResponseOrBuilder.java new file mode 100644 index 00000000..35d5d0c0 --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BatchProcessResponseOrBuilder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2020 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/v1beta3/document_processor_service.proto + +package com.google.cloud.documentai.v1beta3; + +public interface BatchProcessResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.BatchProcessResponse) + com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BoundingPoly.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BoundingPoly.java new file mode 100644 index 00000000..d17c5cfb --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BoundingPoly.java @@ -0,0 +1,1478 @@ +/* + * Copyright 2020 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/v1beta3/geometry.proto + +package com.google.cloud.documentai.v1beta3; + +/** + * + * + *
+ * A bounding polygon for the detected image annotation.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta3.BoundingPoly} + */ +public final class BoundingPoly extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.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(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BoundingPoly( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + vertices_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + vertices_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Vertex.parser(), extensionRegistry)); + break; + } + case 18: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + normalizedVertices_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + normalizedVertices_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.NormalizedVertex.parser(), + extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + vertices_ = java.util.Collections.unmodifiableList(vertices_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + normalizedVertices_ = java.util.Collections.unmodifiableList(normalizedVertices_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.GeometryProto + .internal_static_google_cloud_documentai_v1beta3_BoundingPoly_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.GeometryProto + .internal_static_google_cloud_documentai_v1beta3_BoundingPoly_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BoundingPoly.class, + com.google.cloud.documentai.v1beta3.BoundingPoly.Builder.class); + } + + public static final int VERTICES_FIELD_NUMBER = 1; + private java.util.List vertices_; + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + @java.lang.Override + public java.util.List getVerticesList() { + return vertices_; + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + @java.lang.Override + public java.util.List + getVerticesOrBuilderList() { + return vertices_; + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + @java.lang.Override + public int getVerticesCount() { + return vertices_.size(); + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Vertex getVertices(int index) { + return vertices_.get(index); + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.VertexOrBuilder getVerticesOrBuilder(int index) { + return vertices_.get(index); + } + + public static final int NORMALIZED_VERTICES_FIELD_NUMBER = 2; + private java.util.List normalizedVertices_; + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + @java.lang.Override + public java.util.List + getNormalizedVerticesList() { + return normalizedVertices_; + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + @java.lang.Override + public java.util.List + getNormalizedVerticesOrBuilderList() { + return normalizedVertices_; + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + @java.lang.Override + public int getNormalizedVerticesCount() { + return normalizedVertices_.size(); + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.NormalizedVertex getNormalizedVertices(int index) { + return normalizedVertices_.get(index); + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.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)); + } + unknownFields.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 += unknownFields.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.v1beta3.BoundingPoly)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.BoundingPoly other = + (com.google.cloud.documentai.v1beta3.BoundingPoly) obj; + + if (!getVerticesList().equals(other.getVerticesList())) return false; + if (!getNormalizedVerticesList().equals(other.getNormalizedVerticesList())) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.BoundingPoly parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.BoundingPoly parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.BoundingPoly parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.BoundingPoly parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.BoundingPoly parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.BoundingPoly} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.BoundingPoly) + com.google.cloud.documentai.v1beta3.BoundingPolyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.GeometryProto + .internal_static_google_cloud_documentai_v1beta3_BoundingPoly_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.GeometryProto + .internal_static_google_cloud_documentai_v1beta3_BoundingPoly_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.BoundingPoly.class, + com.google.cloud.documentai.v1beta3.BoundingPoly.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta3.BoundingPoly.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getVerticesFieldBuilder(); + getNormalizedVerticesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (verticesBuilder_ == null) { + vertices_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + verticesBuilder_.clear(); + } + if (normalizedVerticesBuilder_ == null) { + normalizedVertices_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + normalizedVerticesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.GeometryProto + .internal_static_google_cloud_documentai_v1beta3_BoundingPoly_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BoundingPoly getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.BoundingPoly.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BoundingPoly build() { + com.google.cloud.documentai.v1beta3.BoundingPoly result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.BoundingPoly buildPartial() { + com.google.cloud.documentai.v1beta3.BoundingPoly result = + new com.google.cloud.documentai.v1beta3.BoundingPoly(this); + int from_bitField0_ = bitField0_; + 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(); + } + onBuilt(); + return result; + } + + @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.v1beta3.BoundingPoly) { + return mergeFrom((com.google.cloud.documentai.v1beta3.BoundingPoly) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta3.BoundingPoly other) { + if (other == com.google.cloud.documentai.v1beta3.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.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.BoundingPoly parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.documentai.v1beta3.BoundingPoly) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + 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.v1beta3.Vertex, + com.google.cloud.documentai.v1beta3.Vertex.Builder, + com.google.cloud.documentai.v1beta3.VertexOrBuilder> + verticesBuilder_; + + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public int getVerticesCount() { + if (verticesBuilder_ == null) { + return vertices_.size(); + } else { + return verticesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta3.Vertex getVertices(int index) { + if (verticesBuilder_ == null) { + return vertices_.get(index); + } else { + return verticesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + public Builder setVertices(int index, com.google.cloud.documentai.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public Builder setVertices( + int index, com.google.cloud.documentai.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public Builder addVertices(com.google.cloud.documentai.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public Builder addVertices(int index, com.google.cloud.documentai.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public Builder addVertices(com.google.cloud.documentai.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public Builder addVertices( + int index, com.google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta3.Vertex.Builder getVerticesBuilder(int index) { + return getVerticesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta3.VertexOrBuilder getVerticesOrBuilder(int index) { + if (verticesBuilder_ == null) { + return vertices_.get(index); + } else { + return verticesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.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.v1beta3.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta3.Vertex.Builder addVerticesBuilder() { + return getVerticesFieldBuilder() + .addBuilder(com.google.cloud.documentai.v1beta3.Vertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta3.Vertex.Builder addVerticesBuilder(int index) { + return getVerticesFieldBuilder() + .addBuilder(index, com.google.cloud.documentai.v1beta3.Vertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + public java.util.List + getVerticesBuilderList() { + return getVerticesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Vertex, + com.google.cloud.documentai.v1beta3.Vertex.Builder, + com.google.cloud.documentai.v1beta3.VertexOrBuilder> + getVerticesFieldBuilder() { + if (verticesBuilder_ == null) { + verticesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Vertex, + com.google.cloud.documentai.v1beta3.Vertex.Builder, + com.google.cloud.documentai.v1beta3.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.v1beta3.NormalizedVertex, + com.google.cloud.documentai.v1beta3.NormalizedVertex.Builder, + com.google.cloud.documentai.v1beta3.NormalizedVertexOrBuilder> + normalizedVerticesBuilder_; + + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder setNormalizedVertices( + int index, com.google.cloud.documentai.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder setNormalizedVertices( + int index, com.google.cloud.documentai.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + com.google.cloud.documentai.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + int index, com.google.cloud.documentai.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + com.google.cloud.documentai.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + int index, com.google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta3.NormalizedVertex.Builder + getNormalizedVerticesBuilder(int index) { + return getNormalizedVerticesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta3.NormalizedVertex.Builder + addNormalizedVerticesBuilder() { + return getNormalizedVerticesFieldBuilder() + .addBuilder(com.google.cloud.documentai.v1beta3.NormalizedVertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta3.NormalizedVertex.Builder + addNormalizedVerticesBuilder(int index) { + return getNormalizedVerticesFieldBuilder() + .addBuilder( + index, com.google.cloud.documentai.v1beta3.NormalizedVertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + public java.util.List + getNormalizedVerticesBuilderList() { + return getNormalizedVerticesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.NormalizedVertex, + com.google.cloud.documentai.v1beta3.NormalizedVertex.Builder, + com.google.cloud.documentai.v1beta3.NormalizedVertexOrBuilder> + getNormalizedVerticesFieldBuilder() { + if (normalizedVerticesBuilder_ == null) { + normalizedVerticesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta3.NormalizedVertex, + com.google.cloud.documentai.v1beta3.NormalizedVertex.Builder, + com.google.cloud.documentai.v1beta3.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.v1beta3.BoundingPoly) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.BoundingPoly) + private static final com.google.cloud.documentai.v1beta3.BoundingPoly DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta3.BoundingPoly(); + } + + public static com.google.cloud.documentai.v1beta3.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 { + return new BoundingPoly(input, extensionRegistry); + } + }; + + 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.v1beta3.BoundingPoly getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BoundingPolyOrBuilder.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BoundingPolyOrBuilder.java new file mode 100644 index 00000000..de7b5f4a --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/BoundingPolyOrBuilder.java @@ -0,0 +1,135 @@ +/* + * Copyright 2020 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/v1beta3/geometry.proto + +package com.google.cloud.documentai.v1beta3; + +public interface BoundingPolyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.BoundingPoly) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + java.util.List getVerticesList(); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + com.google.cloud.documentai.v1beta3.Vertex getVertices(int index); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + int getVerticesCount(); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + java.util.List + getVerticesOrBuilderList(); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.Vertex vertices = 1; + */ + com.google.cloud.documentai.v1beta3.VertexOrBuilder getVerticesOrBuilder(int index); + + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + java.util.List getNormalizedVerticesList(); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + com.google.cloud.documentai.v1beta3.NormalizedVertex getNormalizedVertices(int index); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + int getNormalizedVerticesCount(); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + java.util.List + getNormalizedVerticesOrBuilderList(); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta3.NormalizedVertex normalized_vertices = 2; + * + */ + com.google.cloud.documentai.v1beta3.NormalizedVertexOrBuilder getNormalizedVerticesOrBuilder( + int index); +} diff --git a/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/Document.java b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/Document.java new file mode 100644 index 00000000..bc73806c --- /dev/null +++ b/proto-google-cloud-document-ai-v1beta3/src/main/java/com/google/cloud/documentai/v1beta3/Document.java @@ -0,0 +1,59654 @@ +/* + * Copyright 2020 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/v1beta3/document.proto + +package com.google.cloud.documentai.v1beta3; + +/** + * + * + *
+ * 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.v1beta3.Document} + */ +public final class Document extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.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(); + translations_ = java.util.Collections.emptyList(); + textChanges_ = java.util.Collections.emptyList(); + revisions_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Document(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Document( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + sourceCase_ = 1; + source_ = s; + break; + } + case 18: + { + sourceCase_ = 2; + source_ = input.readBytes(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + mimeType_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + text_ = s; + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + textStyles_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + textStyles_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.Style.parser(), + extensionRegistry)); + break; + } + case 50: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + pages_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + pages_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.Page.parser(), + extensionRegistry)); + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + entities_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; + } + entities_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.Entity.parser(), + extensionRegistry)); + break; + } + case 66: + { + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + entityRelations_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.Document.EntityRelation>(); + mutable_bitField0_ |= 0x00000008; + } + entityRelations_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.EntityRelation.parser(), + extensionRegistry)); + break; + } + case 74: + { + com.google.cloud.documentai.v1beta3.Document.ShardInfo.Builder subBuilder = null; + if (shardInfo_ != null) { + subBuilder = shardInfo_.toBuilder(); + } + shardInfo_ = + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.ShardInfo.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(shardInfo_); + shardInfo_ = subBuilder.buildPartial(); + } + + break; + } + case 82: + { + com.google.rpc.Status.Builder subBuilder = null; + if (error_ != null) { + subBuilder = error_.toBuilder(); + } + error_ = input.readMessage(com.google.rpc.Status.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(error_); + error_ = subBuilder.buildPartial(); + } + + break; + } + case 98: + { + if (!((mutable_bitField0_ & 0x00000010) != 0)) { + translations_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.Document.Translation>(); + mutable_bitField0_ |= 0x00000010; + } + translations_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.Translation.parser(), + extensionRegistry)); + break; + } + case 106: + { + if (!((mutable_bitField0_ & 0x00000040) != 0)) { + revisions_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.Document.Revision>(); + mutable_bitField0_ |= 0x00000040; + } + revisions_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.Revision.parser(), + extensionRegistry)); + break; + } + case 114: + { + if (!((mutable_bitField0_ & 0x00000020) != 0)) { + textChanges_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta3.Document.TextChange>(); + mutable_bitField0_ |= 0x00000020; + } + textChanges_.add( + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.TextChange.parser(), + extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + textStyles_ = java.util.Collections.unmodifiableList(textStyles_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + pages_ = java.util.Collections.unmodifiableList(pages_); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + entityRelations_ = java.util.Collections.unmodifiableList(entityRelations_); + } + if (((mutable_bitField0_ & 0x00000010) != 0)) { + translations_ = java.util.Collections.unmodifiableList(translations_); + } + if (((mutable_bitField0_ & 0x00000040) != 0)) { + revisions_ = java.util.Collections.unmodifiableList(revisions_); + } + if (((mutable_bitField0_ & 0x00000020) != 0)) { + textChanges_ = java.util.Collections.unmodifiableList(textChanges_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.Document.class, + com.google.cloud.documentai.v1beta3.Document.Builder.class); + } + + public interface ShardInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.Document.ShardInfo} + */ + public static final class ShardInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.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(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ShardInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + shardIndex_ = input.readInt64(); + break; + } + case 16: + { + shardCount_ = input.readInt64(); + break; + } + case 24: + { + textOffset_ = input.readInt64(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_ShardInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_ShardInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.Document.ShardInfo.class, + com.google.cloud.documentai.v1beta3.Document.ShardInfo.Builder.class); + } + + public static final int SHARD_INDEX_FIELD_NUMBER = 1; + 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_; + } + + public static final int SHARD_COUNT_FIELD_NUMBER = 2; + private long shardCount_; + /** + * + * + *
+     * 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_; + /** + * + * + *
+     * The index of the first character in [Document.text][google.cloud.documentai.v1beta3.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_); + } + unknownFields.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 += unknownFields.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.v1beta3.Document.ShardInfo)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.Document.ShardInfo other = + (com.google.cloud.documentai.v1beta3.Document.ShardInfo) obj; + + if (getShardIndex() != other.getShardIndex()) return false; + if (getShardCount() != other.getShardCount()) return false; + if (getTextOffset() != other.getTextOffset()) return false; + if (!unknownFields.equals(other.unknownFields)) 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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.Document.ShardInfo parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.Document.ShardInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.Document.ShardInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.Document.ShardInfo} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.Document.ShardInfo) + com.google.cloud.documentai.v1beta3.Document.ShardInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_ShardInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_ShardInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.Document.ShardInfo.class, + com.google.cloud.documentai.v1beta3.Document.ShardInfo.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta3.Document.ShardInfo.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + shardIndex_ = 0L; + + shardCount_ = 0L; + + textOffset_ = 0L; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_ShardInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.ShardInfo getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.Document.ShardInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.ShardInfo build() { + com.google.cloud.documentai.v1beta3.Document.ShardInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.ShardInfo buildPartial() { + com.google.cloud.documentai.v1beta3.Document.ShardInfo result = + new com.google.cloud.documentai.v1beta3.Document.ShardInfo(this); + result.shardIndex_ = shardIndex_; + result.shardCount_ = shardCount_; + result.textOffset_ = textOffset_; + onBuilt(); + return result; + } + + @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.v1beta3.Document.ShardInfo) { + return mergeFrom((com.google.cloud.documentai.v1beta3.Document.ShardInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta3.Document.ShardInfo other) { + if (other == com.google.cloud.documentai.v1beta3.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.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.Document.ShardInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.Document.ShardInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + 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; + onChanged(); + return this; + } + /** + * + * + *
+       * The 0-based index of this shard.
+       * 
+ * + * int64 shard_index = 1; + * + * @return This builder for chaining. + */ + public Builder clearShardIndex() { + + 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; + onChanged(); + return this; + } + /** + * + * + *
+       * Total number of shards.
+       * 
+ * + * int64 shard_count = 2; + * + * @return This builder for chaining. + */ + public Builder clearShardCount() { + + shardCount_ = 0L; + onChanged(); + return this; + } + + private long textOffset_; + /** + * + * + *
+       * The index of the first character in [Document.text][google.cloud.documentai.v1beta3.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.v1beta3.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; + onChanged(); + return this; + } + /** + * + * + *
+       * The index of the first character in [Document.text][google.cloud.documentai.v1beta3.Document.text] in the overall
+       * document global text.
+       * 
+ * + * int64 text_offset = 3; + * + * @return This builder for chaining. + */ + public Builder clearTextOffset() { + + 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.v1beta3.Document.ShardInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.Document.ShardInfo) + private static final com.google.cloud.documentai.v1beta3.Document.ShardInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta3.Document.ShardInfo(); + } + + public static com.google.cloud.documentai.v1beta3.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 { + return new ShardInfo(input, extensionRegistry); + } + }; + + 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.v1beta3.Document.ShardInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface StyleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.Document.Style) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + * + * @return Whether the textAnchor field is set. + */ + boolean hasTextAnchor(); + /** + * + * + *
+     * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + * + * @return The textAnchor. + */ + com.google.cloud.documentai.v1beta3.Document.TextAnchor getTextAnchor(); + /** + * + * + *
+     * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + com.google.cloud.documentai.v1beta3.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.v1beta3.Document.Style.FontSize font_size = 7; + * + * @return Whether the fontSize field is set. + */ + boolean hasFontSize(); + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + * + * @return The fontSize. + */ + com.google.cloud.documentai.v1beta3.Document.Style.FontSize getFontSize(); + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + com.google.cloud.documentai.v1beta3.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.v1beta3.Document.Style} + */ + public static final class Style extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.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(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Style( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.documentai.v1beta3.Document.TextAnchor.Builder subBuilder = null; + if (textAnchor_ != null) { + subBuilder = textAnchor_.toBuilder(); + } + textAnchor_ = + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.TextAnchor.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(textAnchor_); + textAnchor_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.type.Color.Builder subBuilder = null; + if (color_ != null) { + subBuilder = color_.toBuilder(); + } + color_ = input.readMessage(com.google.type.Color.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(color_); + color_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.type.Color.Builder subBuilder = null; + if (backgroundColor_ != null) { + subBuilder = backgroundColor_.toBuilder(); + } + backgroundColor_ = + input.readMessage(com.google.type.Color.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(backgroundColor_); + backgroundColor_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + fontWeight_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + textStyle_ = s; + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + textDecoration_ = s; + break; + } + case 58: + { + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder subBuilder = + null; + if (fontSize_ != null) { + subBuilder = fontSize_.toBuilder(); + } + fontSize_ = + input.readMessage( + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(fontSize_); + fontSize_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.Document.Style.class, + com.google.cloud.documentai.v1beta3.Document.Style.Builder.class); + } + + public interface FontSizeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta3.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.v1beta3.Document.Style.FontSize} + */ + public static final class FontSize extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta3.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(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private FontSize( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 13: + { + size_ = input.readFloat(); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + unit_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_FontSize_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_FontSize_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.class, + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder.class); + } + + public static final int SIZE_FIELD_NUMBER = 1; + private float size_; + /** + * + * + *
+       * 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; + 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 (size_ != 0F) { + output.writeFloat(1, size_); + } + if (!getUnitBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, unit_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (size_ != 0F) { + size += com.google.protobuf.CodedOutputStream.computeFloatSize(1, size_); + } + if (!getUnitBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, unit_); + } + size += unknownFields.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.v1beta3.Document.Style.FontSize)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.Document.Style.FontSize other = + (com.google.cloud.documentai.v1beta3.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 (!unknownFields.equals(other.unknownFields)) 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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.Document.Style.FontSize parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.Document.Style.FontSize parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.Document.Style.FontSize parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.Document.Style.FontSize} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.Document.Style.FontSize) + com.google.cloud.documentai.v1beta3.Document.Style.FontSizeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_FontSize_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_FontSize_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.class, + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta3.Document.Style.FontSize.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + size_ = 0F; + + unit_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_FontSize_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style.FontSize + getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.Document.Style.FontSize.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style.FontSize build() { + com.google.cloud.documentai.v1beta3.Document.Style.FontSize result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style.FontSize buildPartial() { + com.google.cloud.documentai.v1beta3.Document.Style.FontSize result = + new com.google.cloud.documentai.v1beta3.Document.Style.FontSize(this); + result.size_ = size_; + result.unit_ = unit_; + onBuilt(); + return result; + } + + @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.v1beta3.Document.Style.FontSize) { + return mergeFrom((com.google.cloud.documentai.v1beta3.Document.Style.FontSize) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.documentai.v1beta3.Document.Style.FontSize other) { + if (other + == com.google.cloud.documentai.v1beta3.Document.Style.FontSize.getDefaultInstance()) + return this; + if (other.getSize() != 0F) { + setSize(other.getSize()); + } + if (!other.getUnit().isEmpty()) { + unit_ = other.unit_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.Document.Style.FontSize parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.Document.Style.FontSize) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + 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; + onChanged(); + return this; + } + /** + * + * + *
+         * Font size for the text.
+         * 
+ * + * float size = 1; + * + * @return This builder for chaining. + */ + public Builder clearSize() { + + 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; + 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(); + 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; + 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.v1beta3.Document.Style.FontSize) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.Document.Style.FontSize) + private static final com.google.cloud.documentai.v1beta3.Document.Style.FontSize + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta3.Document.Style.FontSize(); + } + + public static com.google.cloud.documentai.v1beta3.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 { + return new FontSize(input, extensionRegistry); + } + }; + + 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.v1beta3.Document.Style.FontSize + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int TEXT_ANCHOR_FIELD_NUMBER = 1; + private com.google.cloud.documentai.v1beta3.Document.TextAnchor textAnchor_; + /** + * + * + *
+     * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + * + * @return Whether the textAnchor field is set. + */ + @java.lang.Override + public boolean hasTextAnchor() { + return textAnchor_ != null; + } + /** + * + * + *
+     * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + * + * @return The textAnchor. + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.TextAnchor getTextAnchor() { + return textAnchor_ == null + ? com.google.cloud.documentai.v1beta3.Document.TextAnchor.getDefaultInstance() + : textAnchor_; + } + /** + * + * + *
+     * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.TextAnchorOrBuilder + getTextAnchorOrBuilder() { + return getTextAnchor(); + } + + 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 color_ != null; + } + /** + * + * + *
+     * 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 getColor(); + } + + 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 backgroundColor_ != null; + } + /** + * + * + *
+     * 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 getBackgroundColor(); + } + + public static final int FONT_WEIGHT_FIELD_NUMBER = 4; + 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; + 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; + 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.v1beta3.Document.Style.FontSize fontSize_; + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + * + * @return Whether the fontSize field is set. + */ + @java.lang.Override + public boolean hasFontSize() { + return fontSize_ != null; + } + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + * + * @return The fontSize. + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style.FontSize getFontSize() { + return fontSize_ == null + ? com.google.cloud.documentai.v1beta3.Document.Style.FontSize.getDefaultInstance() + : fontSize_; + } + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style.FontSizeOrBuilder + getFontSizeOrBuilder() { + return getFontSize(); + } + + 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 (textAnchor_ != null) { + output.writeMessage(1, getTextAnchor()); + } + if (color_ != null) { + output.writeMessage(2, getColor()); + } + if (backgroundColor_ != null) { + output.writeMessage(3, getBackgroundColor()); + } + if (!getFontWeightBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, fontWeight_); + } + if (!getTextStyleBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, textStyle_); + } + if (!getTextDecorationBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, textDecoration_); + } + if (fontSize_ != null) { + output.writeMessage(7, getFontSize()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (textAnchor_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getTextAnchor()); + } + if (color_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getColor()); + } + if (backgroundColor_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getBackgroundColor()); + } + if (!getFontWeightBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, fontWeight_); + } + if (!getTextStyleBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, textStyle_); + } + if (!getTextDecorationBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, textDecoration_); + } + if (fontSize_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getFontSize()); + } + size += unknownFields.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.v1beta3.Document.Style)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta3.Document.Style other = + (com.google.cloud.documentai.v1beta3.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 (!unknownFields.equals(other.unknownFields)) 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) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta3.Document.Style parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.Document.Style parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.Document.Style parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.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.v1beta3.Document.Style} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta3.Document.Style) + com.google.cloud.documentai.v1beta3.Document.StyleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta3.Document.Style.class, + com.google.cloud.documentai.v1beta3.Document.Style.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta3.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) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (textAnchorBuilder_ == null) { + textAnchor_ = null; + } else { + textAnchor_ = null; + textAnchorBuilder_ = null; + } + if (colorBuilder_ == null) { + color_ = null; + } else { + color_ = null; + colorBuilder_ = null; + } + if (backgroundColorBuilder_ == null) { + backgroundColor_ = null; + } else { + backgroundColor_ = null; + backgroundColorBuilder_ = null; + } + fontWeight_ = ""; + + textStyle_ = ""; + + textDecoration_ = ""; + + if (fontSizeBuilder_ == null) { + fontSize_ = null; + } else { + fontSize_ = null; + fontSizeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta3.DocumentProto + .internal_static_google_cloud_documentai_v1beta3_Document_Style_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta3.Document.Style.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style build() { + com.google.cloud.documentai.v1beta3.Document.Style result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta3.Document.Style buildPartial() { + com.google.cloud.documentai.v1beta3.Document.Style result = + new com.google.cloud.documentai.v1beta3.Document.Style(this); + if (textAnchorBuilder_ == null) { + result.textAnchor_ = textAnchor_; + } else { + result.textAnchor_ = textAnchorBuilder_.build(); + } + if (colorBuilder_ == null) { + result.color_ = color_; + } else { + result.color_ = colorBuilder_.build(); + } + if (backgroundColorBuilder_ == null) { + result.backgroundColor_ = backgroundColor_; + } else { + result.backgroundColor_ = backgroundColorBuilder_.build(); + } + result.fontWeight_ = fontWeight_; + result.textStyle_ = textStyle_; + result.textDecoration_ = textDecoration_; + if (fontSizeBuilder_ == null) { + result.fontSize_ = fontSize_; + } else { + result.fontSize_ = fontSizeBuilder_.build(); + } + onBuilt(); + return result; + } + + @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.v1beta3.Document.Style) { + return mergeFrom((com.google.cloud.documentai.v1beta3.Document.Style) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta3.Document.Style other) { + if (other == com.google.cloud.documentai.v1beta3.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_; + onChanged(); + } + if (!other.getTextStyle().isEmpty()) { + textStyle_ = other.textStyle_; + onChanged(); + } + if (!other.getTextDecoration().isEmpty()) { + textDecoration_ = other.textDecoration_; + onChanged(); + } + if (other.hasFontSize()) { + mergeFontSize(other.getFontSize()); + } + this.mergeUnknownFields(other.unknownFields); + 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 { + com.google.cloud.documentai.v1beta3.Document.Style parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta3.Document.Style) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.documentai.v1beta3.Document.TextAnchor textAnchor_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Document.TextAnchor, + com.google.cloud.documentai.v1beta3.Document.TextAnchor.Builder, + com.google.cloud.documentai.v1beta3.Document.TextAnchorOrBuilder> + textAnchorBuilder_; + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + * + * @return Whether the textAnchor field is set. + */ + public boolean hasTextAnchor() { + return textAnchorBuilder_ != null || textAnchor_ != null; + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + * + * @return The textAnchor. + */ + public com.google.cloud.documentai.v1beta3.Document.TextAnchor getTextAnchor() { + if (textAnchorBuilder_ == null) { + return textAnchor_ == null + ? com.google.cloud.documentai.v1beta3.Document.TextAnchor.getDefaultInstance() + : textAnchor_; + } else { + return textAnchorBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + public Builder setTextAnchor(com.google.cloud.documentai.v1beta3.Document.TextAnchor value) { + if (textAnchorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + textAnchor_ = value; + onChanged(); + } else { + textAnchorBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + public Builder setTextAnchor( + com.google.cloud.documentai.v1beta3.Document.TextAnchor.Builder builderForValue) { + if (textAnchorBuilder_ == null) { + textAnchor_ = builderForValue.build(); + onChanged(); + } else { + textAnchorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + public Builder mergeTextAnchor( + com.google.cloud.documentai.v1beta3.Document.TextAnchor value) { + if (textAnchorBuilder_ == null) { + if (textAnchor_ != null) { + textAnchor_ = + com.google.cloud.documentai.v1beta3.Document.TextAnchor.newBuilder(textAnchor_) + .mergeFrom(value) + .buildPartial(); + } else { + textAnchor_ = value; + } + onChanged(); + } else { + textAnchorBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + public Builder clearTextAnchor() { + if (textAnchorBuilder_ == null) { + textAnchor_ = null; + onChanged(); + } else { + textAnchor_ = null; + textAnchorBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + public com.google.cloud.documentai.v1beta3.Document.TextAnchor.Builder + getTextAnchorBuilder() { + + onChanged(); + return getTextAnchorFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + public com.google.cloud.documentai.v1beta3.Document.TextAnchorOrBuilder + getTextAnchorOrBuilder() { + if (textAnchorBuilder_ != null) { + return textAnchorBuilder_.getMessageOrBuilder(); + } else { + return textAnchor_ == null + ? com.google.cloud.documentai.v1beta3.Document.TextAnchor.getDefaultInstance() + : textAnchor_; + } + } + /** + * + * + *
+       * Text anchor indexing into the [Document.text][google.cloud.documentai.v1beta3.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.TextAnchor text_anchor = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Document.TextAnchor, + com.google.cloud.documentai.v1beta3.Document.TextAnchor.Builder, + com.google.cloud.documentai.v1beta3.Document.TextAnchorOrBuilder> + getTextAnchorFieldBuilder() { + if (textAnchorBuilder_ == null) { + textAnchorBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Document.TextAnchor, + com.google.cloud.documentai.v1beta3.Document.TextAnchor.Builder, + com.google.cloud.documentai.v1beta3.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 colorBuilder_ != null || color_ != null; + } + /** + * + * + *
+       * 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; + onChanged(); + } else { + colorBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Text color.
+       * 
+ * + * .google.type.Color color = 2; + */ + public Builder setColor(com.google.type.Color.Builder builderForValue) { + if (colorBuilder_ == null) { + color_ = builderForValue.build(); + onChanged(); + } else { + colorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Text color.
+       * 
+ * + * .google.type.Color color = 2; + */ + public Builder mergeColor(com.google.type.Color value) { + if (colorBuilder_ == null) { + if (color_ != null) { + color_ = com.google.type.Color.newBuilder(color_).mergeFrom(value).buildPartial(); + } else { + color_ = value; + } + onChanged(); + } else { + colorBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Text color.
+       * 
+ * + * .google.type.Color color = 2; + */ + public Builder clearColor() { + if (colorBuilder_ == null) { + color_ = null; + onChanged(); + } else { + color_ = null; + colorBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * Text color.
+       * 
+ * + * .google.type.Color color = 2; + */ + public com.google.type.Color.Builder getColorBuilder() { + + 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 backgroundColorBuilder_ != null || backgroundColor_ != null; + } + /** + * + * + *
+       * 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; + onChanged(); + } else { + backgroundColorBuilder_.setMessage(value); + } + + 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(); + onChanged(); + } else { + backgroundColorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Text background color.
+       * 
+ * + * .google.type.Color background_color = 3; + */ + public Builder mergeBackgroundColor(com.google.type.Color value) { + if (backgroundColorBuilder_ == null) { + if (backgroundColor_ != null) { + backgroundColor_ = + com.google.type.Color.newBuilder(backgroundColor_).mergeFrom(value).buildPartial(); + } else { + backgroundColor_ = value; + } + onChanged(); + } else { + backgroundColorBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Text background color.
+       * 
+ * + * .google.type.Color background_color = 3; + */ + public Builder clearBackgroundColor() { + if (backgroundColorBuilder_ == null) { + backgroundColor_ = null; + onChanged(); + } else { + backgroundColor_ = null; + backgroundColorBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * Text background color.
+       * 
+ * + * .google.type.Color background_color = 3; + */ + public com.google.type.Color.Builder getBackgroundColorBuilder() { + + 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; + 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(); + 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; + 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; + 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(); + 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; + 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; + 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(); + 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; + onChanged(); + return this; + } + + private com.google.cloud.documentai.v1beta3.Document.Style.FontSize fontSize_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Document.Style.FontSize, + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder, + com.google.cloud.documentai.v1beta3.Document.Style.FontSizeOrBuilder> + fontSizeBuilder_; + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + * + * @return Whether the fontSize field is set. + */ + public boolean hasFontSize() { + return fontSizeBuilder_ != null || fontSize_ != null; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + * + * @return The fontSize. + */ + public com.google.cloud.documentai.v1beta3.Document.Style.FontSize getFontSize() { + if (fontSizeBuilder_ == null) { + return fontSize_ == null + ? com.google.cloud.documentai.v1beta3.Document.Style.FontSize.getDefaultInstance() + : fontSize_; + } else { + return fontSizeBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + public Builder setFontSize( + com.google.cloud.documentai.v1beta3.Document.Style.FontSize value) { + if (fontSizeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fontSize_ = value; + onChanged(); + } else { + fontSizeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + public Builder setFontSize( + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder builderForValue) { + if (fontSizeBuilder_ == null) { + fontSize_ = builderForValue.build(); + onChanged(); + } else { + fontSizeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + public Builder mergeFontSize( + com.google.cloud.documentai.v1beta3.Document.Style.FontSize value) { + if (fontSizeBuilder_ == null) { + if (fontSize_ != null) { + fontSize_ = + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.newBuilder(fontSize_) + .mergeFrom(value) + .buildPartial(); + } else { + fontSize_ = value; + } + onChanged(); + } else { + fontSizeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + public Builder clearFontSize() { + if (fontSizeBuilder_ == null) { + fontSize_ = null; + onChanged(); + } else { + fontSize_ = null; + fontSizeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + public com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder + getFontSizeBuilder() { + + onChanged(); + return getFontSizeFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + public com.google.cloud.documentai.v1beta3.Document.Style.FontSizeOrBuilder + getFontSizeOrBuilder() { + if (fontSizeBuilder_ != null) { + return fontSizeBuilder_.getMessageOrBuilder(); + } else { + return fontSize_ == null + ? com.google.cloud.documentai.v1beta3.Document.Style.FontSize.getDefaultInstance() + : fontSize_; + } + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta3.Document.Style.FontSize font_size = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Document.Style.FontSize, + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder, + com.google.cloud.documentai.v1beta3.Document.Style.FontSizeOrBuilder> + getFontSizeFieldBuilder() { + if (fontSizeBuilder_ == null) { + fontSizeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta3.Document.Style.FontSize, + com.google.cloud.documentai.v1beta3.Document.Style.FontSize.Builder, + com.google.cloud.documentai.v1beta3.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.v1beta3.Document.Style) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta3.Document.Style) + private static final com.google.cloud.documentai.v1beta3.Document.Style DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta3.Document.Style(); + } + + public static com.google.cloud.documentai.v1beta3.Document.Style getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser