diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..31669f9b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +Please run down the following list and make sure you've tried the usual "quick fixes": + + - Search the issues already opened: https://github.com/googleapis/java-document-ai/issues + - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform + +If you are still having issues, please include as much information as possible: + +#### Environment details + +1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). + General, Core, and Other are also allowed as types +2. OS type and version: +3. Java version: +4. documentai version(s): + +#### Steps to reproduce + + 1. ? + 2. ? + +#### Code example + +```java +// example +``` + +#### Stack trace +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides + +- ? + +#### Any additional information below + + +Following these steps guarantees the quickest resolution possible. + +Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..754e30c6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this library + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +**Is your feature request related to a problem? Please describe.** +What the problem is. Example: I'm always frustrated when [...] + +**Describe the solution you'd like** +What you want to happen. + +**Describe alternatives you've considered** +Any alternative solutions or features you've considered. + +**Additional context** +Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 00000000..99586903 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,7 @@ +--- +name: Support request +about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. + +--- + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..0bd0ee06 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1 @@ +Fixes # (it's a good idea to open an issue first for context and/or discussion) \ No newline at end of file diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 00000000..82744682 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1 @@ +releaseType: java-yoshi diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..84dac387 --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +.gitignore + +# Packages +dist +bin +var +sdist +target + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg + +.metadata +.project +.pydevproject +*.iml +.idea +.settings +.DS_Store +.classpath +.vscode + +# Built documentation +docs/ + + +# Wheel directory used in Travis builds. +gcloud-java-wheels/ +src/test/resources/gcd-head.zip +src/test/resources/gcd-v1beta2-rev1-2.1.1.zip + +# API key file containing value of GOOGLE_API_KEY for integration tests +api_key + +# Python utilities +*.pyc +artman-genfiles +venv \ No newline at end of file diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 00000000..6b61f497 --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,3 @@ +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" github/java-document-ai/.kokoro/build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 00000000..fa132f41 --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# Copyright 2019 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 +# +# http://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. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# Print out Java version +java -version +echo ${JOB_TYPE} + +mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_ROOT}/src/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +case ${JOB_TYPE} in +test) + mvn test -B -Dclirr.skip=true + bash ${KOKORO_GFILE_DIR}/codecov.sh + bash .kokoro/coerce_logs.sh + ;; +lint) + mvn com.coveo:fmt-maven-plugin:check + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} -DtrimStackTrace=false -Dclirr.skip=true -fae verify + bash .kokoro/coerce_logs.sh + ;; +clirr) + mvn -B clirr:check + ;; +*) + ;; +esac \ No newline at end of file diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 00000000..5cf7ba49 --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright 2019 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 +# +# http://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. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + echo "processing ${xml}" + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 00000000..816602d3 --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "java-document-ai/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/build.sh" +} diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 00000000..37d3f445 --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-document-ai/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/continuous/dependencies.cfg b/.kokoro/continuous/dependencies.cfg new file mode 100644 index 00000000..49a81dea --- /dev/null +++ b/.kokoro/continuous/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/dependencies.sh" +} diff --git a/.kokoro/continuous/integration.cfg b/.kokoro/continuous/integration.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/continuous/integration.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/continuous/java11.cfg b/.kokoro/continuous/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/continuous/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/continuous/java7.cfg b/.kokoro/continuous/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/continuous/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/continuous/java8-osx.cfg b/.kokoro/continuous/java8-osx.cfg new file mode 100644 index 00000000..f300e131 --- /dev/null +++ b/.kokoro/continuous/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-document-ai/.kokoro/build.sh" diff --git a/.kokoro/continuous/java8-win.cfg b/.kokoro/continuous/java8-win.cfg new file mode 100644 index 00000000..f532a2fa --- /dev/null +++ b/.kokoro/continuous/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-document-ai/.kokoro/build.bat" diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/continuous/lint.cfg b/.kokoro/continuous/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/continuous/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/continuous/propose_release.cfg b/.kokoro/continuous/propose_release.cfg new file mode 100644 index 00000000..dd5151f2 --- /dev/null +++ b/.kokoro/continuous/propose_release.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-document-ai/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/continuous/propose_release.sh" +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/continuous/propose_release.sh b/.kokoro/continuous/propose_release.sh new file mode 100755 index 00000000..894879fc --- /dev/null +++ b/.kokoro/continuous/propose_release.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Copyright 2019 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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then + # Groom the release PR as new commits are merged. + npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ + --repo-url=googleapis/java-document-ai \ + --package-name="documentai" \ + --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ + --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ + --release-type=java-yoshi +fi diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 00000000..9470b9c1 --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright 2019 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 +# +# http://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. + +set -eo pipefail + +cd github/java-document-ai/ + +# Print out Java +java -version +echo $JOB_TYPE + +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" + +mvn install -DskipTests=true -B -V +mvn -B dependency:analyze -DfailOnWarning=true diff --git a/.kokoro/linkage-monitor.sh b/.kokoro/linkage-monitor.sh new file mode 100755 index 00000000..7c94f33e --- /dev/null +++ b/.kokoro/linkage-monitor.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 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 +# +# http://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. + +set -eo pipefail +# Display commands being run. +set -x + +cd github/java-document-ai/ + +# Print out Java version +java -version +echo ${JOB_TYPE} + +mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V + +# Kokoro job cloud-opensource-java/ubuntu/linkage-monitor-gcs creates this JAR +JAR=linkage-monitor-latest-all-deps.jar +curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/${JAR}" + +# Fails if there's new linkage errors compared with baseline +java -jar ${JAR} com.google.cloud:libraries-bom diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 00000000..37d3f445 --- /dev/null +++ b/.kokoro/nightly/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-document-ai/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/nightly/dependencies.cfg b/.kokoro/nightly/dependencies.cfg new file mode 100644 index 00000000..49a81dea --- /dev/null +++ b/.kokoro/nightly/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/dependencies.sh" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/nightly/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/nightly/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg new file mode 100644 index 00000000..f300e131 --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-document-ai/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 00000000..f532a2fa --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-document-ai/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/nightly/lint.cfg b/.kokoro/nightly/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/nightly/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg new file mode 100644 index 00000000..ec572442 --- /dev/null +++ b/.kokoro/presubmit/clirr.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "clirr" +} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 00000000..9faa6bfd --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-document-ai/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg new file mode 100644 index 00000000..49a81dea --- /dev/null +++ b/.kokoro/presubmit/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 00000000..141f90c1 --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,31 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} + +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "keystore/73713_java_it_service_account" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "java_it_service_account" + } + } +} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/presubmit/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/presubmit/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg new file mode 100644 index 00000000..f300e131 --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-document-ai/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 00000000..f532a2fa --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-document-ai/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 00000000..2c0189d3 --- /dev/null +++ b/.kokoro/presubmit/linkage-monitor.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 00000000..182a9b95 --- /dev/null +++ b/.kokoro/release/bump_snapshot.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-document-ai/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/release/bump_snapshot.sh" +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/release/bump_snapshot.sh b/.kokoro/release/bump_snapshot.sh new file mode 100755 index 00000000..048ece9d --- /dev/null +++ b/.kokoro/release/bump_snapshot.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright 2019 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. + +set -eo pipefail + +export NPM_CONFIG_PREFIX=/home/node/.npm-global + +if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then + # Groom the snapshot release PR immediately after publishing a release + npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ + --repo-url=googleapis/java-document-ai \ + --package-name="documentai" \ + --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ + --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ + --snapshot \ + --release-type=java-auth-yoshi +fi diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 00000000..ab102837 --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-document-ai/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 00000000..6e3f6599 --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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 +# +# http://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. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg new file mode 100644 index 00000000..fda0dbbe --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,9 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/release/drop.sh" +} + +# Download staging properties file. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java/releases/java-document-ai" \ No newline at end of file diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 00000000..5c4551ef --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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 +# +# http://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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 00000000..c0da0fec --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,10 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/release/promote.sh" +} + +# Download staging properties file. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java/releases/java-document-ai" + diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 00000000..1fa95fa5 --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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 +# +# http://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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 00000000..b570fe2b --- /dev/null +++ b/.kokoro/release/publish_javadoc.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto +env_vars: { + key: "STAGING_BUCKET" + value: "docs-staging" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/release/publish_javadoc.sh" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh new file mode 100755 index 00000000..a2aaf7c2 --- /dev/null +++ b/.kokoro/release/publish_javadoc.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Copyright 2019 Google Inc. +# +# 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 +# +# http://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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET}" ]]; then + echo "Need to set STAGING_BUCKET environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -DskipTests=true + +NAME=documentai +VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# build the docs +mvn site -B + +pushd target/site/apidocs + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload docs +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET} + +popd diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 00000000..06821560 --- /dev/null +++ b/.kokoro/release/snapshot.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/release/snapshot.sh" +} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh new file mode 100755 index 00000000..098168a7 --- /dev/null +++ b/.kokoro/release/snapshot.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 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 +# +# http://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. + +set -eo pipefail + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +# ensure we're trying to push a snapshot (no-result returns non-zero exit code) +grep SNAPSHOT versions.txt + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean install deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 00000000..e1b2058a --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,44 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-document-ai/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-document-ai/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-document-ai" + } +} + +# Fetch the token needed for reporting release status to GitHub +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "yoshi-automation-github-key" + } + } +} + +# Fetch magictoken to use with Magic Github Proxy +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "releasetool-magictoken" + } + } +} + +# Fetch api key to use with Magic Github Proxy +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "magic-github-proxy-api-key" + } + } +} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100755 index 00000000..3c482cbc --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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 +# +# http://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. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean install deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} + +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml +fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 00000000..ba17ce01 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# 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 +# +# http://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. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 00000000..0dd1f0ae --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,13 @@ +{ + "name": "documentai", + "name_pretty": "Google Cloud OS Login", + "product_documentation": "https://cloud.google.com/compute/docs/documentai/", + "client_documentation": "https://googleapis.dev/java/google-cloud-clients/latest/index.html?com/google/cloud/documentai/v1/package-summary.html", + "issue_tracker": "https://issuetracker.google.com/savedsearches/559755", + "release_level": "alpha", + "language": "java", + "repo": "googleapis/java-document-ai", + "repo_short": "java-document-ai", + "distribution_name": "com.google.cloud:google-cloud-documentai", + "api_id": "documentai.googleapis.com" +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..6b2238bb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,93 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the +Project Steward(s) for *[PROJECT NAME]*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..ebbb59e5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,28 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + http://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. diff --git a/README.md b/README.md new file mode 100644 index 00000000..1a43ef17 --- /dev/null +++ b/README.md @@ -0,0 +1,113 @@ +Google Cloud Java Client for Cloud Document AI +============================================== + +Java idiomatic client for Document AI. + +[![Kokoro CI](http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/master.svg)](http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/master.html) +[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-documentai.svg)](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-documentai.svg) +[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/google-cloud-java) + + +> Note: This client is a work-in-progress, and may occasionally +> make backwards-incompatible changes. + +Quickstart +---------- +If you are using Maven with Bom, Add this to your pom.xml file. +```xml + + + + com.google.cloud + libraries-bom + 2.8.0 + pom + import + + + + + + com.google.cloud + google-cloud-documentai + +``` +[//]: # ({x-version-update-start:google-cloud-documentai:released}) +If you are using Maven without Bom, Add this to your dependencies. +```xml + + com.google.cloud + google-cloud-documentai + 0.1.0 + +``` +If you are using Gradle, add this to your dependencies +```Groovy +compile 'com.google.cloud:google-cloud-documentai:0.1.0' +``` +If you are using SBT, add this to your dependencies +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-documentai" % "0.1.0" +``` +[//]: # ({x-version-update-end}) + +Authentication +-------------- + +See the [Authentication](https://github.com/googleapis/google-cloud-java#authentication) section in the base directory's README. + +About Google Cloud Cloud Document AI +------------------------------------ + + +See the Cloud Document AI client library docs to learn how to use this Document AI API Client Library. + +Getting Started +--------------- +#### Prerequisites +You will need a [Google Developers Console](https://console.developers.google.com/) project with the Cloud Document AI API enabled. [Follow these instructions](https://cloud.google.com/resource-manager/docs/creating-managing-projects) to get your project set up. You will also need to set up the local development environment by [installing the Google Cloud SDK](https://cloud.google.com/sdk/) and running the following commands in command line: `gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. + +#### Installation and setup +You'll need to obtain the `google-cloud-documentai` library. See the [Quickstart](#quickstart) section to add `google-cloud-documentai` as a dependency in your code. + +Troubleshooting +--------------- + +To get help, follow the instructions in the [shared Troubleshooting document](https://github.com/googleapis/google-cloud-common/blob/master/troubleshooting/readme.md#troubleshooting). + +Transport +--------- +Cloud Document AI uses gRPC for the transport layer. + +Java Versions +------------- + +Java 7 or above is required for using this client. + +Versioning +---------- + +This library follows [Semantic Versioning](http://semver.org/). + +It is currently in major version zero (``0.y.z``), which means that anything may change at any time and the public API should not be considered stable. + +Contributing +------------ + +Contributions to this library are always welcome and highly encouraged. + +See `google-cloud`'s [CONTRIBUTING] documentation and the [shared documentation](https://github.com/googleapis/google-cloud-common/blob/master/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information. + +License +------- + +Apache 2.0 - See [LICENSE] for more information. + + +[CONTRIBUTING]:https://github.com/googleapis/java-documentai/blob/master/CONTRIBUTING.md +[code-of-conduct]:https://github.com/googleapis/java-documentai/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[LICENSE]: https://github.com/googleapis/java-documentai/blob/master/LICENSE +[cloud-platform]: https://cloud.google.com/ +[client-lib-docs]: https://googleapis.dev/java/google-cloud-clients/latest/index.html?com/google/cloud/documentai/v2/package-summary.html \ No newline at end of file diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 00000000..5724ea94 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/google-cloud-documentai-bom/pom.xml b/google-cloud-documentai-bom/pom.xml new file mode 100644 index 00000000..bf378df5 --- /dev/null +++ b/google-cloud-documentai-bom/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + com.google.cloud + google-cloud-documentai-bom + 0.1.0-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.2.1 + + + Google Cloud Document AI BOM + https://github.com/googleapis/java-documentai + + BOM for Google Cloud Document AI + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-documentai.git + scm:git:git@github.com:googleapis/java-documentai.git + https://github.com/googleapis/java-documentai + + + + + 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 + + + + + + + com.google.api.grpc + proto-google-cloud-documentai-v1beta1 + 0.1.0-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-documentai-v1beta1 + 0.1.0-SNAPSHOT + + + com.google.cloud + google-cloud-documentai + 0.1.0-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + \ No newline at end of file diff --git a/google-cloud-documentai/pom.xml b/google-cloud-documentai/pom.xml new file mode 100644 index 00000000..fb0c87ed --- /dev/null +++ b/google-cloud-documentai/pom.xml @@ -0,0 +1,101 @@ + + + 4.0.0 + com.google.cloud + google-cloud-documentai + 0.1.0-SNAPSHOT + jar + Google Cloud Document AI + https://github.com/googleapis/java-documentai + Java idiomatic client for Google Cloud Document AI + + com.google.cloud + google-cloud-documentai-parent + 0.1.0-SNAPSHOT + + + google-cloud-documentai + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-documentai-v1beta1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + + + com.google.api.grpc + grpc-google-cloud-documentai-v1beta1 + test + + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java new file mode 100644 index 00000000..c1509ecc --- /dev/null +++ b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClient.java @@ -0,0 +1,301 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.documentai.v1beta1.stub.DocumentUnderstandingServiceStub; +import com.google.cloud.documentai.v1beta1.stub.DocumentUnderstandingServiceStubSettings; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Service to parse structured information from unstructured or semi-structured + * documents using state-of-the-art Google AI such as natural language, computer vision, and + * translation. + * + *

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

+ * 
+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.create()) {
+ *   List<ProcessDocumentRequest> requests = new ArrayList<>();
+ *   BatchProcessDocumentsResponse response = documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
+ * }
+ * 
+ * 
+ * + *

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

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

To customize credentials: + * + *

+ * 
+ * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
+ *     DocumentUnderstandingServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
+ *     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings =
+ *     DocumentUnderstandingServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * DocumentUnderstandingServiceClient documentUnderstandingServiceClient =
+ *     DocumentUnderstandingServiceClient.create(documentUnderstandingServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DocumentUnderstandingServiceClient implements BackgroundResource { + private final DocumentUnderstandingServiceSettings settings; + private final DocumentUnderstandingServiceStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of DocumentUnderstandingServiceClient with default settings. */ + public static final DocumentUnderstandingServiceClient create() throws IOException { + return create(DocumentUnderstandingServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of DocumentUnderstandingServiceClient, using the given settings. The + * channels are created based on the settings passed in, or defaults for any settings that are not + * set. + */ + public static final DocumentUnderstandingServiceClient create( + DocumentUnderstandingServiceSettings settings) throws IOException { + return new DocumentUnderstandingServiceClient(settings); + } + + /** + * Constructs an instance of DocumentUnderstandingServiceClient, using the given stub for making + * calls. This is for advanced usage - prefer to use DocumentUnderstandingServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final DocumentUnderstandingServiceClient create( + DocumentUnderstandingServiceStub stub) { + return new DocumentUnderstandingServiceClient(stub); + } + + /** + * Constructs an instance of DocumentUnderstandingServiceClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected DocumentUnderstandingServiceClient(DocumentUnderstandingServiceSettings settings) + throws IOException { + this.settings = settings; + this.stub = + ((DocumentUnderstandingServiceStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected DocumentUnderstandingServiceClient(DocumentUnderstandingServiceStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final DocumentUnderstandingServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DocumentUnderstandingServiceStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @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 + /** + * LRO endpoint to batch process many documents. + * + *

Sample code: + * + *


+   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.create()) {
+   *   List<ProcessDocumentRequest> requests = new ArrayList<>();
+   *   BatchProcessDocumentsResponse response = documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests).get();
+   * }
+   * 
+ * + * @param requests Required. Individual requests for each document. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + batchProcessDocumentsAsync(List requests) { + + BatchProcessDocumentsRequest request = + BatchProcessDocumentsRequest.newBuilder().addAllRequests(requests).build(); + return batchProcessDocumentsAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * LRO endpoint to batch process many documents. + * + *

Sample code: + * + *


+   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.create()) {
+   *   List<ProcessDocumentRequest> requests = new ArrayList<>();
+   *   BatchProcessDocumentsRequest request = BatchProcessDocumentsRequest.newBuilder()
+   *     .addAllRequests(requests)
+   *     .build();
+   *   BatchProcessDocumentsResponse response = documentUnderstandingServiceClient.batchProcessDocumentsAsync(request).get();
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture + batchProcessDocumentsAsync(BatchProcessDocumentsRequest request) { + return batchProcessDocumentsOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * LRO endpoint to batch process many documents. + * + *

Sample code: + * + *


+   * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.create()) {
+   *   List<ProcessDocumentRequest> requests = new ArrayList<>();
+   *   BatchProcessDocumentsRequest request = BatchProcessDocumentsRequest.newBuilder()
+   *     .addAllRequests(requests)
+   *     .build();
+   *   OperationFuture<BatchProcessDocumentsResponse, OperationMetadata> future = documentUnderstandingServiceClient.batchProcessDocumentsOperationCallable().futureCall(request);
+   *   // Do something
+   *   BatchProcessDocumentsResponse response = future.get();
+   * }
+   * 
+ */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationCallable() { + return stub.batchProcessDocumentsOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * LRO endpoint to batch process many documents. + * + *

Sample code: + * + *


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

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

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

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

For example, to set the total timeout of batchProcessDocumentsAsync to 30 seconds: + * + *

+ * 
+ * DocumentUnderstandingServiceSettings.Builder documentUnderstandingServiceSettingsBuilder =
+ *     DocumentUnderstandingServiceSettings.newBuilder();
+ * documentUnderstandingServiceSettingsBuilder.batchProcessDocumentsSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * DocumentUnderstandingServiceSettings documentUnderstandingServiceSettings = documentUnderstandingServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DocumentUnderstandingServiceSettings + extends ClientSettings { + /** Returns the object with the settings used for calls to batchProcessDocuments. */ + public UnaryCallSettings + batchProcessDocumentsSettings() { + return ((DocumentUnderstandingServiceStubSettings) getStubSettings()) + .batchProcessDocumentsSettings(); + } + + /** Returns the object with the settings used for calls to batchProcessDocuments. */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public OperationCallSettings< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationSettings() { + return ((DocumentUnderstandingServiceStubSettings) getStubSettings()) + .batchProcessDocumentsOperationSettings(); + } + + public static final DocumentUnderstandingServiceSettings create( + DocumentUnderstandingServiceStubSettings stub) throws IOException { + return new DocumentUnderstandingServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return DocumentUnderstandingServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return DocumentUnderstandingServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DocumentUnderstandingServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return DocumentUnderstandingServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return DocumentUnderstandingServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return DocumentUnderstandingServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return DocumentUnderstandingServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DocumentUnderstandingServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for DocumentUnderstandingServiceSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(DocumentUnderstandingServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(DocumentUnderstandingServiceStubSettings.newBuilder()); + } + + protected Builder(DocumentUnderstandingServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(DocumentUnderstandingServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public DocumentUnderstandingServiceStubSettings.Builder getStubSettingsBuilder() { + return ((DocumentUnderstandingServiceStubSettings.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 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< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationSettings() { + return getStubSettingsBuilder().batchProcessDocumentsOperationSettings(); + } + + @Override + public DocumentUnderstandingServiceSettings build() throws IOException { + return new DocumentUnderstandingServiceSettings(this); + } + } +} diff --git a/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java new file mode 100644 index 00000000..71a15f5c --- /dev/null +++ b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/package-info.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to Cloud Document AI API. + * + *

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

================================== DocumentUnderstandingServiceClient + * ================================== + * + *

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

Sample for DocumentUnderstandingServiceClient: + * + *

+ * 
+ * try (DocumentUnderstandingServiceClient documentUnderstandingServiceClient = DocumentUnderstandingServiceClient.create()) {
+ *   List<ProcessDocumentRequest> requests = new ArrayList<>();
+ *   BatchProcessDocumentsResponse response = documentUnderstandingServiceClient.batchProcessDocumentsAsync(requests);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.documentai.v1beta1; + +import javax.annotation.Generated; diff --git a/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java new file mode 100644 index 00000000..046c4b7e --- /dev/null +++ b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStub.java @@ -0,0 +1,58 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; +import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; +import com.google.cloud.documentai.v1beta1.OperationMetadata; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for 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 DocumentUnderstandingServiceStub 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()"); + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationCallable() { + throw new UnsupportedOperationException( + "Not implemented: batchProcessDocumentsOperationCallable()"); + } + + public UnaryCallable batchProcessDocumentsCallable() { + throw new UnsupportedOperationException("Not implemented: batchProcessDocumentsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java new file mode 100644 index 00000000..27ecc227 --- /dev/null +++ b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/DocumentUnderstandingServiceStubSettings.java @@ -0,0 +1,332 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; +import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; +import com.google.cloud.documentai.v1beta1.OperationMetadata; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link DocumentUnderstandingServiceStub}. + * + *

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

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

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

For example, to set the total timeout of batchProcessDocumentsAsync to 30 seconds: + * + *

+ * 
+ * DocumentUnderstandingServiceStubSettings.Builder documentUnderstandingServiceSettingsBuilder =
+ *     DocumentUnderstandingServiceStubSettings.newBuilder();
+ * documentUnderstandingServiceSettingsBuilder.batchProcessDocumentsSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * DocumentUnderstandingServiceStubSettings documentUnderstandingServiceSettings = documentUnderstandingServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class DocumentUnderstandingServiceStubSettings + extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings + batchProcessDocumentsSettings; + private final OperationCallSettings< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationSettings; + + /** Returns the object with the settings used for calls to batchProcessDocuments. */ + public UnaryCallSettings + batchProcessDocumentsSettings() { + return batchProcessDocumentsSettings; + } + + /** Returns the object with the settings used for calls to batchProcessDocuments. */ + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationSettings() { + return batchProcessDocumentsOperationSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public DocumentUnderstandingServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcDocumentUnderstandingServiceStub.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 "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(DocumentUnderstandingServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected DocumentUnderstandingServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + batchProcessDocumentsSettings = settingsBuilder.batchProcessDocumentsSettings().build(); + batchProcessDocumentsOperationSettings = + settingsBuilder.batchProcessDocumentsOperationSettings().build(); + } + + /** Builder for DocumentUnderstandingServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + batchProcessDocumentsSettings; + private final OperationCallSettings.Builder< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", 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(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + batchProcessDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + batchProcessDocumentsOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(batchProcessDocumentsSettings); + + initDefaults(this); + } + + 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 + .batchProcessDocumentsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + builder + .batchProcessDocumentsOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create( + BatchProcessDocumentsResponse.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(20000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) // ignored + .setRpcTimeoutMultiplier(1.0) // ignored + .setMaxRpcTimeout(Duration.ZERO) // ignored + .setTotalTimeout(Duration.ofMillis(86400000L)) + .build())); + + return builder; + } + + protected Builder(DocumentUnderstandingServiceStubSettings settings) { + super(settings); + + batchProcessDocumentsSettings = settings.batchProcessDocumentsSettings.toBuilder(); + batchProcessDocumentsOperationSettings = + settings.batchProcessDocumentsOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(batchProcessDocumentsSettings); + } + + // 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 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< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationSettings() { + return batchProcessDocumentsOperationSettings; + } + + @Override + public DocumentUnderstandingServiceStubSettings build() throws IOException { + return new DocumentUnderstandingServiceStubSettings(this); + } + } +} diff --git a/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java new file mode 100644 index 00000000..888cc471 --- /dev/null +++ b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.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 GrpcDocumentUnderstandingServiceCallableFactory implements GrpcStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings 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-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java new file mode 100644 index 00000000..22e5790f --- /dev/null +++ b/google-cloud-documentai/src/main/java/com/google/cloud/documentai/v1beta1/stub/GrpcDocumentUnderstandingServiceStub.java @@ -0,0 +1,190 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest; +import com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse; +import com.google.cloud.documentai.v1beta1.OperationMetadata; +import com.google.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 GrpcDocumentUnderstandingServiceStub extends DocumentUnderstandingServiceStub { + + private static final MethodDescriptor + batchProcessDocumentsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.documentai.v1beta1.DocumentUnderstandingService/BatchProcessDocuments") + .setRequestMarshaller( + ProtoUtils.marshaller(BatchProcessDocumentsRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + + private final UnaryCallable + batchProcessDocumentsCallable; + private final OperationCallable< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcDocumentUnderstandingServiceStub create( + DocumentUnderstandingServiceStubSettings settings) throws IOException { + return new GrpcDocumentUnderstandingServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcDocumentUnderstandingServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcDocumentUnderstandingServiceStub( + DocumentUnderstandingServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcDocumentUnderstandingServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcDocumentUnderstandingServiceStub( + DocumentUnderstandingServiceStubSettings.newBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of GrpcDocumentUnderstandingServiceStub, using the given settings. This + * is protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcDocumentUnderstandingServiceStub( + DocumentUnderstandingServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcDocumentUnderstandingServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcDocumentUnderstandingServiceStub, using the given settings. This + * is protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected GrpcDocumentUnderstandingServiceStub( + DocumentUnderstandingServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings + batchProcessDocumentsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(batchProcessDocumentsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(BatchProcessDocumentsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + + this.batchProcessDocumentsCallable = + callableFactory.createUnaryCallable( + batchProcessDocumentsTransportSettings, + settings.batchProcessDocumentsSettings(), + clientContext); + this.batchProcessDocumentsOperationCallable = + callableFactory.createOperationCallable( + batchProcessDocumentsTransportSettings, + settings.batchProcessDocumentsOperationSettings(), + 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; + } + + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallable< + BatchProcessDocumentsRequest, BatchProcessDocumentsResponse, OperationMetadata> + batchProcessDocumentsOperationCallable() { + return batchProcessDocumentsOperationCallable; + } + + public UnaryCallable batchProcessDocumentsCallable() { + return batchProcessDocumentsCallable; + } + + @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-documentai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java b/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java new file mode 100644 index 00000000..95586d51 --- /dev/null +++ b/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceClientTest.java @@ -0,0 +1,129 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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 DocumentUnderstandingServiceClientTest { + private static MockDocumentUnderstandingService mockDocumentUnderstandingService; + private static MockServiceHelper serviceHelper; + private DocumentUnderstandingServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockDocumentUnderstandingService = new MockDocumentUnderstandingService(); + serviceHelper = + new MockServiceHelper( + "in-process-1", Arrays.asList(mockDocumentUnderstandingService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + DocumentUnderstandingServiceSettings settings = + DocumentUnderstandingServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = DocumentUnderstandingServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void batchProcessDocumentsTest() throws Exception { + BatchProcessDocumentsResponse expectedResponse = + BatchProcessDocumentsResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("batchProcessDocumentsTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockDocumentUnderstandingService.addResponse(resultOperation); + + List requests = new ArrayList<>(); + + BatchProcessDocumentsResponse actualResponse = + client.batchProcessDocumentsAsync(requests).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockDocumentUnderstandingService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + BatchProcessDocumentsRequest actualRequest = + (BatchProcessDocumentsRequest) actualRequests.get(0); + + Assert.assertEquals(requests, actualRequest.getRequestsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void batchProcessDocumentsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockDocumentUnderstandingService.addException(exception); + + try { + List requests = new ArrayList<>(); + + client.batchProcessDocumentsAsync(requests).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java b/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java new file mode 100644 index 00000000..62713173 --- /dev/null +++ b/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingService.java @@ -0,0 +1,57 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockDocumentUnderstandingService implements MockGrpcService { + private final MockDocumentUnderstandingServiceImpl serviceImpl; + + public MockDocumentUnderstandingService() { + serviceImpl = new MockDocumentUnderstandingServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java b/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java new file mode 100644 index 00000000..5127ca1b --- /dev/null +++ b/google-cloud-documentai/src/test/java/com/google/cloud/documentai/v1beta1/MockDocumentUnderstandingServiceImpl.java @@ -0,0 +1,74 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.cloud.documentai.v1beta1.DocumentUnderstandingServiceGrpc.DocumentUnderstandingServiceImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockDocumentUnderstandingServiceImpl extends DocumentUnderstandingServiceImplBase { + private List requests; + private Queue responses; + + public MockDocumentUnderstandingServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void batchProcessDocuments( + BatchProcessDocumentsRequest request, StreamObserver responseObserver) { + Object response = responses.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-documentai-v1beta1/pom.xml b/grpc-google-cloud-documentai-v1beta1/pom.xml new file mode 100644 index 00000000..2322c330 --- /dev/null +++ b/grpc-google-cloud-documentai-v1beta1/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-documentai-v1beta1 + 0.1.0-SNAPSHOT + grpc-google-cloud-documentai-v1beta1 + GRPC library for grpc-google-cloud-documentai-v1beta1 + + com.google.cloud + google-cloud-documentai-parent + 0.1.0-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-documentai-v1beta1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceGrpc.java b/grpc-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceGrpc.java new file mode 100644 index 00000000..0ba4f1e4 --- /dev/null +++ b/grpc-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/DocumentUnderstandingServiceGrpc.java @@ -0,0 +1,383 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.documentai.v1beta1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +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 parse structured information from unstructured or semi-structured
+ * documents using state-of-the-art Google AI such as natural language,
+ * computer vision, and translation.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler (version 1.10.0)", + comments = "Source: google/cloud/documentai/v1beta1/document_understanding.proto") +public final class DocumentUnderstandingServiceGrpc { + + private DocumentUnderstandingServiceGrpc() {} + + public static final String SERVICE_NAME = + "google.cloud.documentai.v1beta1.DocumentUnderstandingService"; + + // Static method descriptors that strictly reflect the proto. + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getBatchProcessDocumentsMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, + com.google.longrunning.Operation> + METHOD_BATCH_PROCESS_DOCUMENTS = getBatchProcessDocumentsMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, + com.google.longrunning.Operation> + getBatchProcessDocumentsMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, + com.google.longrunning.Operation> + getBatchProcessDocumentsMethod() { + return getBatchProcessDocumentsMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, + com.google.longrunning.Operation> + getBatchProcessDocumentsMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, + com.google.longrunning.Operation> + getBatchProcessDocumentsMethod; + if ((getBatchProcessDocumentsMethod = + DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod) + == null) { + synchronized (DocumentUnderstandingServiceGrpc.class) { + if ((getBatchProcessDocumentsMethod = + DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod) + == null) { + DocumentUnderstandingServiceGrpc.getBatchProcessDocumentsMethod = + getBatchProcessDocumentsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.documentai.v1beta1.DocumentUnderstandingService", + "BatchProcessDocuments")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new DocumentUnderstandingServiceMethodDescriptorSupplier( + "BatchProcessDocuments")) + .build(); + } + } + } + return getBatchProcessDocumentsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static DocumentUnderstandingServiceStub newStub(io.grpc.Channel channel) { + return new DocumentUnderstandingServiceStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static DocumentUnderstandingServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + return new DocumentUnderstandingServiceBlockingStub(channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static DocumentUnderstandingServiceFutureStub newFutureStub(io.grpc.Channel channel) { + return new DocumentUnderstandingServiceFutureStub(channel); + } + + /** + * + * + *
+   * Service to parse structured information from unstructured or semi-structured
+   * documents using state-of-the-art Google AI such as natural language,
+   * computer vision, and translation.
+   * 
+ */ + public abstract static class DocumentUnderstandingServiceImplBase + implements io.grpc.BindableService { + + /** + * + * + *
+     * LRO endpoint to batch process many documents.
+     * 
+ */ + public void batchProcessDocuments( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getBatchProcessDocumentsMethodHelper(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getBatchProcessDocumentsMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest, + com.google.longrunning.Operation>(this, METHODID_BATCH_PROCESS_DOCUMENTS))) + .build(); + } + } + + /** + * + * + *
+   * Service to parse structured information from unstructured or semi-structured
+   * documents using state-of-the-art Google AI such as natural language,
+   * computer vision, and translation.
+   * 
+ */ + public static final class DocumentUnderstandingServiceStub + extends io.grpc.stub.AbstractStub { + private DocumentUnderstandingServiceStub(io.grpc.Channel channel) { + super(channel); + } + + private DocumentUnderstandingServiceStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DocumentUnderstandingServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentUnderstandingServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * LRO endpoint to batch process many documents.
+     * 
+ */ + public void batchProcessDocuments( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getBatchProcessDocumentsMethodHelper(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Service to parse structured information from unstructured or semi-structured
+   * documents using state-of-the-art Google AI such as natural language,
+   * computer vision, and translation.
+   * 
+ */ + public static final class DocumentUnderstandingServiceBlockingStub + extends io.grpc.stub.AbstractStub { + private DocumentUnderstandingServiceBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private DocumentUnderstandingServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DocumentUnderstandingServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentUnderstandingServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * LRO endpoint to batch process many documents.
+     * 
+ */ + public com.google.longrunning.Operation batchProcessDocuments( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request) { + return blockingUnaryCall( + getChannel(), getBatchProcessDocumentsMethodHelper(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Service to parse structured information from unstructured or semi-structured
+   * documents using state-of-the-art Google AI such as natural language,
+   * computer vision, and translation.
+   * 
+ */ + public static final class DocumentUnderstandingServiceFutureStub + extends io.grpc.stub.AbstractStub { + private DocumentUnderstandingServiceFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private DocumentUnderstandingServiceFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected DocumentUnderstandingServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new DocumentUnderstandingServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * LRO endpoint to batch process many documents.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + batchProcessDocuments( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest request) { + return futureUnaryCall( + getChannel().newCall(getBatchProcessDocumentsMethodHelper(), getCallOptions()), request); + } + } + + private static final int METHODID_BATCH_PROCESS_DOCUMENTS = 0; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final DocumentUnderstandingServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(DocumentUnderstandingServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_BATCH_PROCESS_DOCUMENTS: + serviceImpl.batchProcessDocuments( + (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class DocumentUnderstandingServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + DocumentUnderstandingServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("DocumentUnderstandingService"); + } + } + + private static final class DocumentUnderstandingServiceFileDescriptorSupplier + extends DocumentUnderstandingServiceBaseDescriptorSupplier { + DocumentUnderstandingServiceFileDescriptorSupplier() {} + } + + private static final class DocumentUnderstandingServiceMethodDescriptorSupplier + extends DocumentUnderstandingServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + DocumentUnderstandingServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (DocumentUnderstandingServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new DocumentUnderstandingServiceFileDescriptorSupplier()) + .addMethod(getBatchProcessDocumentsMethodHelper()) + .build(); + } + } + } + return result; + } +} diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 00000000..6597fced --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..05fd3e7c --- /dev/null +++ b/pom.xml @@ -0,0 +1,252 @@ + + + 4.0.0 + com.google.cloud + google-cloud-documentai-parent + pom + 0.1.0-SNAPSHOT + Google Cloud Document AI Parent + https://github.com/googleapis/java-documentai + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 0.2.1 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-documentai.git + scm:git:git@github.com:googleapis/java-documentai.git + https://github.com/googleapis/java-documentai + HEAD + + + https://github.com/googleapis/java-documentai/issues + GitHub Issues + + + + sonatype-nexus-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-documentai-parent + 1.91.1 + 1.8.1 + 1.17.0 + 1.50.0 + 1.24.1 + 3.10.0 + 4.12 + 28.1-android + 1.4.0 + 1.3.2 + 1.18 + + + + + + com.google.api.grpc + grpc-google-cloud-documentai-v1beta1 + 0.1.0-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-documentai-v1beta1 + 0.1.0-SNAPSHOT + + + + + io.grpc + grpc-bom + ${grpc.version} + pom + import + + + com.google.api + gax-bom + ${gax.version} + pom + import + + + com.google.guava + guava-bom + ${guava.version} + pom + import + + + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + com.google.api + api-common + ${google.api-common.version} + + + com.google.api.grpc + proto-google-common-protos + ${google.common-protos.version} + + + org.threeten + threetenbp + ${threeten.version} + + + javax.annotation + javax.annotation-api + ${javax.annotations.version} + + + org.codehaus.mojo + animal-sniffer-annotations + ${animal-sniffer.version} + + + + junit + junit + ${junit.version} + test + + + com.google.api + gax-grpc + ${gax.version} + testlib + test + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + org.objenesis:objenesis + + + + + + + + proto-google-cloud-documentai-v1beta1 + grpc-google-cloud-documentai-v1beta1 + google-cloud-documentai + google-cloud-documentai-bom + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + + index + dependency-info + team + ci-management + issue-management + licenses + scm + dependency-management + distribution-management + summary + modules + + + + + true + ${site.installationModule} + jar + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + html + + aggregate + javadoc + + + + + none + protected + true + ${project.build.directory}/javadoc + + + Test helpers packages + com.google.cloud.testing + + + SPI packages + com.google.cloud.spi* + + + + + https://grpc.io/grpc-java/javadoc/ + https://developers.google.com/protocol-buffers/docs/reference/java/ + https://googleapis.dev/java/google-auth-library/latest/ + https://googleapis.dev/java/gax/latest/ + https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ + + + + + + \ No newline at end of file diff --git a/proto-google-cloud-documentai-v1beta1/pom.xml b/proto-google-cloud-documentai-v1beta1/pom.xml new file mode 100644 index 00000000..8859b88c --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + com.google.api.grpc + proto-google-cloud-documentai-v1beta1 + 0.1.0-SNAPSHOT + proto-google-cloud-documentai-v1beta1 + PROTO library for proto-google-cloud-documentai-v1beta1 + + com.google.cloud + google-cloud-documentai-parent + 0.1.0-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + \ No newline at end of file diff --git a/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequest.java b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequest.java new file mode 100644 index 00000000..baa7dccf --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequest.java @@ -0,0 +1,1192 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/documentai/v1beta1/document_understanding.proto + +package com.google.cloud.documentai.v1beta1; + +/** + * + * + *
+ * Request to batch process documents as an asynchronous operation.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} + */ +public final class BatchProcessDocumentsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + BatchProcessDocumentsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchProcessDocumentsRequest.newBuilder() to construct. + private BatchProcessDocumentsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchProcessDocumentsRequest() { + requests_ = java.util.Collections.emptyList(); + parent_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchProcessDocumentsRequest( + 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)) { + requests_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest>(); + mutable_bitField0_ |= 0x00000001; + } + requests_.add( + input.readMessage( + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.parser(), + extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = 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 { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + requests_ = java.util.Collections.unmodifiableList(requests_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.class, + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.Builder.class); + } + + private int bitField0_; + public static final int REQUESTS_FIELD_NUMBER = 1; + private java.util.List requests_; + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getRequestsList() { + return requests_; + } + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List< + ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> + getRequestsOrBuilderList() { + return requests_; + } + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getRequestsCount() { + return requests_.size(); + } + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest getRequests(int index) { + return requests_.get(index); + } + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder getRequestsOrBuilder( + int index) { + return requests_.get(index); + } + + public static final int PARENT_FIELD_NUMBER = 2; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Target project and location to make a call.
+   * Format: `projects/{project-id}/locations/{location-id}`.
+   * If no location is specified, a region will be chosen automatically.
+   * 
+ * + * string parent = 2; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Target project and location to make a call.
+   * Format: `projects/{project-id}/locations/{location-id}`.
+   * If no location is specified, a region will be chosen automatically.
+   * 
+ * + * string parent = 2; + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < requests_.size(); i++) { + output.writeMessage(1, requests_.get(i)); + } + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, parent_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < requests_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, requests_.get(i)); + } + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, parent_); + } + 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.v1beta1.BatchProcessDocumentsRequest)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest other = + (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) obj; + + if (!getRequestsList().equals(other.getRequestsList())) return false; + if (!getParent().equals(other.getParent())) return false; + if (!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 (getRequestsCount() > 0) { + hash = (37 * hash) + REQUESTS_FIELD_NUMBER; + hash = (53 * hash) + getRequestsList().hashCode(); + } + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request to batch process documents as an asynchronous operation.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.class, + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getRequestsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (requestsBuilder_ == null) { + requests_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + requestsBuilder_.clear(); + } + parent_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest build() { + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest buildPartial() { + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest result = + new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (requestsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + requests_ = java.util.Collections.unmodifiableList(requests_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.requests_ = requests_; + } else { + result.requests_ = requestsBuilder_.build(); + } + result.parent_ = parent_; + result.bitField0_ = to_bitField0_; + 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.v1beta1.BatchProcessDocumentsRequest) { + return mergeFrom((com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest other) { + if (other + == com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest.getDefaultInstance()) + return this; + if (requestsBuilder_ == null) { + if (!other.requests_.isEmpty()) { + if (requests_.isEmpty()) { + requests_ = other.requests_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureRequestsIsMutable(); + requests_.addAll(other.requests_); + } + onChanged(); + } + } else { + if (!other.requests_.isEmpty()) { + if (requestsBuilder_.isEmpty()) { + requestsBuilder_.dispose(); + requestsBuilder_ = null; + requests_ = other.requests_; + bitField0_ = (bitField0_ & ~0x00000001); + requestsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getRequestsFieldBuilder() + : null; + } else { + requestsBuilder_.addAllMessages(other.requests_); + } + } + } + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + 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.v1beta1.BatchProcessDocumentsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List requests_ = + java.util.Collections.emptyList(); + + private void ensureRequestsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + requests_ = + new java.util.ArrayList( + requests_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> + requestsBuilder_; + + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getRequestsList() { + if (requestsBuilder_ == null) { + return java.util.Collections.unmodifiableList(requests_); + } else { + return requestsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getRequestsCount() { + if (requestsBuilder_ == null) { + return requests_.size(); + } else { + return requestsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest getRequests(int index) { + if (requestsBuilder_ == null) { + return requests_.get(index); + } else { + return requestsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setRequests( + int index, com.google.cloud.documentai.v1beta1.ProcessDocumentRequest value) { + if (requestsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRequestsIsMutable(); + requests_.set(index, value); + onChanged(); + } else { + requestsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setRequests( + int index, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder builderForValue) { + if (requestsBuilder_ == null) { + ensureRequestsIsMutable(); + requests_.set(index, builderForValue.build()); + onChanged(); + } else { + requestsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addRequests(com.google.cloud.documentai.v1beta1.ProcessDocumentRequest value) { + if (requestsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRequestsIsMutable(); + requests_.add(value); + onChanged(); + } else { + requestsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addRequests( + int index, com.google.cloud.documentai.v1beta1.ProcessDocumentRequest value) { + if (requestsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureRequestsIsMutable(); + requests_.add(index, value); + onChanged(); + } else { + requestsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addRequests( + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder builderForValue) { + if (requestsBuilder_ == null) { + ensureRequestsIsMutable(); + requests_.add(builderForValue.build()); + onChanged(); + } else { + requestsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addRequests( + int index, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder builderForValue) { + if (requestsBuilder_ == null) { + ensureRequestsIsMutable(); + requests_.add(index, builderForValue.build()); + onChanged(); + } else { + requestsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addAllRequests( + java.lang.Iterable + values) { + if (requestsBuilder_ == null) { + ensureRequestsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, requests_); + onChanged(); + } else { + requestsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearRequests() { + if (requestsBuilder_ == null) { + requests_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + requestsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder removeRequests(int index) { + if (requestsBuilder_ == null) { + ensureRequestsIsMutable(); + requests_.remove(index); + onChanged(); + } else { + requestsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder getRequestsBuilder( + int index) { + return getRequestsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder getRequestsOrBuilder( + int index) { + if (requestsBuilder_ == null) { + return requests_.get(index); + } else { + return requestsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List< + ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> + getRequestsOrBuilderList() { + if (requestsBuilder_ != null) { + return requestsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(requests_); + } + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder addRequestsBuilder() { + return getRequestsFieldBuilder() + .addBuilder( + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.getDefaultInstance()); + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder addRequestsBuilder( + int index) { + return getRequestsFieldBuilder() + .addBuilder( + index, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.getDefaultInstance()); + } + /** + * + * + *
+     * Required. Individual requests for each document.
+     * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getRequestsBuilderList() { + return getRequestsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder> + getRequestsFieldBuilder() { + if (requestsBuilder_ == null) { + requestsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest.Builder, + com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder>( + requests_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + requests_ = null; + } + return requestsBuilder_; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Target project and location to make a call.
+     * Format: `projects/{project-id}/locations/{location-id}`.
+     * If no location is specified, a region will be chosen automatically.
+     * 
+ * + * string parent = 2; + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Target project and location to make a call.
+     * Format: `projects/{project-id}/locations/{location-id}`.
+     * If no location is specified, a region will be chosen automatically.
+     * 
+ * + * string parent = 2; + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Target project and location to make a call.
+     * Format: `projects/{project-id}/locations/{location-id}`.
+     * If no location is specified, a region will be chosen automatically.
+     * 
+ * + * string parent = 2; + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Target project and location to make a call.
+     * Format: `projects/{project-id}/locations/{location-id}`.
+     * If no location is specified, a region will be chosen automatically.
+     * 
+ * + * string parent = 2; + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Target project and location to make a call.
+     * Format: `projects/{project-id}/locations/{location-id}`.
+     * If no location is specified, a region will be chosen automatically.
+     * 
+ * + * string parent = 2; + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = 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.v1beta1.BatchProcessDocumentsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + private static final com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest(); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchProcessDocumentsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchProcessDocumentsRequest(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.v1beta1.BatchProcessDocumentsRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequestOrBuilder.java b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequestOrBuilder.java new file mode 100644 index 00000000..8aa02eca --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsRequestOrBuilder.java @@ -0,0 +1,113 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/documentai/v1beta1/document_understanding.proto + +package com.google.cloud.documentai.v1beta1; + +public interface BatchProcessDocumentsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.BatchProcessDocumentsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getRequestsList(); + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.documentai.v1beta1.ProcessDocumentRequest getRequests(int index); + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + int getRequestsCount(); + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List + getRequestsOrBuilderList(); + /** + * + * + *
+   * Required. Individual requests for each document.
+   * 
+ * + * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentRequest requests = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.documentai.v1beta1.ProcessDocumentRequestOrBuilder getRequestsOrBuilder( + int index); + + /** + * + * + *
+   * Target project and location to make a call.
+   * Format: `projects/{project-id}/locations/{location-id}`.
+   * If no location is specified, a region will be chosen automatically.
+   * 
+ * + * string parent = 2; + */ + java.lang.String getParent(); + /** + * + * + *
+   * Target project and location to make a call.
+   * Format: `projects/{project-id}/locations/{location-id}`.
+   * If no location is specified, a region will be chosen automatically.
+   * 
+ * + * string parent = 2; + */ + com.google.protobuf.ByteString getParentBytes(); +} diff --git a/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponse.java b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponse.java new file mode 100644 index 00000000..49db8e10 --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponse.java @@ -0,0 +1,973 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/documentai/v1beta1/document_understanding.proto + +package com.google.cloud.documentai.v1beta1; + +/** + * + * + *
+ * Response to an batch document processing request. This is returned in
+ * the LRO Operation after the operation is complete.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} + */ +public final class BatchProcessDocumentsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + BatchProcessDocumentsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use BatchProcessDocumentsResponse.newBuilder() to construct. + private BatchProcessDocumentsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BatchProcessDocumentsResponse() { + responses_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BatchProcessDocumentsResponse( + 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)) { + responses_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse>(); + mutable_bitField0_ |= 0x00000001; + } + responses_.add( + input.readMessage( + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.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)) { + responses_ = java.util.Collections.unmodifiableList(responses_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.class, + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.Builder.class); + } + + public static final int RESPONSES_FIELD_NUMBER = 1; + private java.util.List responses_; + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public java.util.List + getResponsesList() { + return responses_; + } + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public java.util.List< + ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> + getResponsesOrBuilderList() { + return responses_; + } + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public int getResponsesCount() { + return responses_.size(); + } + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse getResponses(int index) { + return responses_.get(index); + } + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder getResponsesOrBuilder( + int index) { + return responses_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < responses_.size(); i++) { + output.writeMessage(1, responses_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < responses_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, responses_.get(i)); + } + size += 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.v1beta1.BatchProcessDocumentsResponse)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse other = + (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) obj; + + if (!getResponsesList().equals(other.getResponsesList())) return false; + if (!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 (getResponsesCount() > 0) { + hash = (37 * hash) + RESPONSES_FIELD_NUMBER; + hash = (53 * hash) + getResponsesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response to an batch document processing request. This is returned in
+   * the LRO Operation after the operation is complete.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.class, + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.Builder.class); + } + + // Construct using + // com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResponsesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (responsesBuilder_ == null) { + responses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + responsesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.documentai.v1beta1.DocumentAiProto + .internal_static_google_cloud_documentai_v1beta1_BatchProcessDocumentsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse build() { + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse buildPartial() { + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse result = + new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(this); + int from_bitField0_ = bitField0_; + if (responsesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + responses_ = java.util.Collections.unmodifiableList(responses_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.responses_ = responses_; + } else { + result.responses_ = responsesBuilder_.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.v1beta1.BatchProcessDocumentsResponse) { + return mergeFrom((com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse other) { + if (other + == com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse.getDefaultInstance()) + return this; + if (responsesBuilder_ == null) { + if (!other.responses_.isEmpty()) { + if (responses_.isEmpty()) { + responses_ = other.responses_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResponsesIsMutable(); + responses_.addAll(other.responses_); + } + onChanged(); + } + } else { + if (!other.responses_.isEmpty()) { + if (responsesBuilder_.isEmpty()) { + responsesBuilder_.dispose(); + responsesBuilder_ = null; + responses_ = other.responses_; + bitField0_ = (bitField0_ & ~0x00000001); + responsesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResponsesFieldBuilder() + : null; + } else { + responsesBuilder_.addAllMessages(other.responses_); + } + } + } + this.mergeUnknownFields(other.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.v1beta1.BatchProcessDocumentsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List responses_ = + java.util.Collections.emptyList(); + + private void ensureResponsesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + responses_ = + new java.util.ArrayList( + responses_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> + responsesBuilder_; + + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public java.util.List + getResponsesList() { + if (responsesBuilder_ == null) { + return java.util.Collections.unmodifiableList(responses_); + } else { + return responsesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public int getResponsesCount() { + if (responsesBuilder_ == null) { + return responses_.size(); + } else { + return responsesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse getResponses(int index) { + if (responsesBuilder_ == null) { + return responses_.get(index); + } else { + return responsesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder setResponses( + int index, com.google.cloud.documentai.v1beta1.ProcessDocumentResponse value) { + if (responsesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResponsesIsMutable(); + responses_.set(index, value); + onChanged(); + } else { + responsesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder setResponses( + int index, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder builderForValue) { + if (responsesBuilder_ == null) { + ensureResponsesIsMutable(); + responses_.set(index, builderForValue.build()); + onChanged(); + } else { + responsesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder addResponses(com.google.cloud.documentai.v1beta1.ProcessDocumentResponse value) { + if (responsesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResponsesIsMutable(); + responses_.add(value); + onChanged(); + } else { + responsesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder addResponses( + int index, com.google.cloud.documentai.v1beta1.ProcessDocumentResponse value) { + if (responsesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResponsesIsMutable(); + responses_.add(index, value); + onChanged(); + } else { + responsesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder addResponses( + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder builderForValue) { + if (responsesBuilder_ == null) { + ensureResponsesIsMutable(); + responses_.add(builderForValue.build()); + onChanged(); + } else { + responsesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder addResponses( + int index, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder builderForValue) { + if (responsesBuilder_ == null) { + ensureResponsesIsMutable(); + responses_.add(index, builderForValue.build()); + onChanged(); + } else { + responsesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder addAllResponses( + java.lang.Iterable + values) { + if (responsesBuilder_ == null) { + ensureResponsesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, responses_); + onChanged(); + } else { + responsesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder clearResponses() { + if (responsesBuilder_ == null) { + responses_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + responsesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public Builder removeResponses(int index) { + if (responsesBuilder_ == null) { + ensureResponsesIsMutable(); + responses_.remove(index); + onChanged(); + } else { + responsesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder getResponsesBuilder( + int index) { + return getResponsesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder + getResponsesOrBuilder(int index) { + if (responsesBuilder_ == null) { + return responses_.get(index); + } else { + return responsesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public java.util.List< + ? extends com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> + getResponsesOrBuilderList() { + if (responsesBuilder_ != null) { + return responsesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(responses_); + } + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder + addResponsesBuilder() { + return getResponsesFieldBuilder() + .addBuilder( + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.getDefaultInstance()); + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder addResponsesBuilder( + int index) { + return getResponsesFieldBuilder() + .addBuilder( + index, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.getDefaultInstance()); + } + /** + * + * + *
+     * Responses for each individual document.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + public java.util.List + getResponsesBuilderList() { + return getResponsesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder> + getResponsesFieldBuilder() { + if (responsesBuilder_ == null) { + responsesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse.Builder, + com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder>( + responses_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + responses_ = null; + } + return responsesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + private static final com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse(); + } + + public static com.google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BatchProcessDocumentsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BatchProcessDocumentsResponse(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.v1beta1.BatchProcessDocumentsResponse + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponseOrBuilder.java b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponseOrBuilder.java new file mode 100644 index 00000000..9466ea08 --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BatchProcessDocumentsResponseOrBuilder.java @@ -0,0 +1,78 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/documentai/v1beta1/document_understanding.proto + +package com.google.cloud.documentai.v1beta1; + +public interface BatchProcessDocumentsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.BatchProcessDocumentsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + java.util.List getResponsesList(); + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + com.google.cloud.documentai.v1beta1.ProcessDocumentResponse getResponses(int index); + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + int getResponsesCount(); + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + java.util.List + getResponsesOrBuilderList(); + /** + * + * + *
+   * Responses for each individual document.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.ProcessDocumentResponse responses = 1; + */ + com.google.cloud.documentai.v1beta1.ProcessDocumentResponseOrBuilder getResponsesOrBuilder( + int index); +} diff --git a/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPoly.java b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPoly.java new file mode 100644 index 00000000..6d3e0e68 --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPoly.java @@ -0,0 +1,1462 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/documentai/v1beta1/geometry.proto + +package com.google.cloud.documentai.v1beta1; + +/** + * + * + *
+ * A bounding polygon for the detected image annotation.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.BoundingPoly} + */ +public final class BoundingPoly extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.BoundingPoly) + BoundingPolyOrBuilder { + private static final long serialVersionUID = 0L; + // Use BoundingPoly.newBuilder() to construct. + private BoundingPoly(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BoundingPoly() { + vertices_ = java.util.Collections.emptyList(); + normalizedVertices_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + 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.v1beta1.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.v1beta1.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.v1beta1.GeometryProto + .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.GeometryProto + .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.BoundingPoly.class, + com.google.cloud.documentai.v1beta1.BoundingPoly.Builder.class); + } + + public static final int VERTICES_FIELD_NUMBER = 1; + private java.util.List vertices_; + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public java.util.List getVerticesList() { + return vertices_; + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public java.util.List + getVerticesOrBuilderList() { + return vertices_; + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public int getVerticesCount() { + return vertices_.size(); + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta1.Vertex getVertices(int index) { + return vertices_.get(index); + } + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta1.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.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public java.util.List + getNormalizedVerticesList() { + return normalizedVertices_; + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public java.util.List + getNormalizedVerticesOrBuilderList() { + return normalizedVertices_; + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public int getNormalizedVerticesCount() { + return normalizedVertices_.size(); + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta1.NormalizedVertex getNormalizedVertices(int index) { + return normalizedVertices_.get(index); + } + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder + getNormalizedVerticesOrBuilder(int index) { + return normalizedVertices_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < vertices_.size(); i++) { + output.writeMessage(1, vertices_.get(i)); + } + for (int i = 0; i < normalizedVertices_.size(); i++) { + output.writeMessage(2, normalizedVertices_.get(i)); + } + 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.v1beta1.BoundingPoly)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta1.BoundingPoly other = + (com.google.cloud.documentai.v1beta1.BoundingPoly) obj; + + if (!getVerticesList().equals(other.getVerticesList())) return false; + if (!getNormalizedVerticesList().equals(other.getNormalizedVerticesList())) return false; + if (!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.v1beta1.BoundingPoly parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.documentai.v1beta1.BoundingPoly prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A bounding polygon for the detected image annotation.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.BoundingPoly} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.BoundingPoly) + com.google.cloud.documentai.v1beta1.BoundingPolyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.GeometryProto + .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.GeometryProto + .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.BoundingPoly.class, + com.google.cloud.documentai.v1beta1.BoundingPoly.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta1.BoundingPoly.newBuilder() + private Builder() { + 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.v1beta1.GeometryProto + .internal_static_google_cloud_documentai_v1beta1_BoundingPoly_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BoundingPoly getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta1.BoundingPoly.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BoundingPoly build() { + com.google.cloud.documentai.v1beta1.BoundingPoly result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.BoundingPoly buildPartial() { + com.google.cloud.documentai.v1beta1.BoundingPoly result = + new com.google.cloud.documentai.v1beta1.BoundingPoly(this); + 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.v1beta1.BoundingPoly) { + return mergeFrom((com.google.cloud.documentai.v1beta1.BoundingPoly) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta1.BoundingPoly other) { + if (other == com.google.cloud.documentai.v1beta1.BoundingPoly.getDefaultInstance()) + return this; + if (verticesBuilder_ == null) { + if (!other.vertices_.isEmpty()) { + if (vertices_.isEmpty()) { + vertices_ = other.vertices_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureVerticesIsMutable(); + vertices_.addAll(other.vertices_); + } + onChanged(); + } + } else { + if (!other.vertices_.isEmpty()) { + if (verticesBuilder_.isEmpty()) { + verticesBuilder_.dispose(); + verticesBuilder_ = null; + vertices_ = other.vertices_; + bitField0_ = (bitField0_ & ~0x00000001); + verticesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getVerticesFieldBuilder() + : null; + } else { + verticesBuilder_.addAllMessages(other.vertices_); + } + } + } + if (normalizedVerticesBuilder_ == null) { + if (!other.normalizedVertices_.isEmpty()) { + if (normalizedVertices_.isEmpty()) { + normalizedVertices_ = other.normalizedVertices_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.addAll(other.normalizedVertices_); + } + onChanged(); + } + } else { + if (!other.normalizedVertices_.isEmpty()) { + if (normalizedVerticesBuilder_.isEmpty()) { + normalizedVerticesBuilder_.dispose(); + normalizedVerticesBuilder_ = null; + normalizedVertices_ = other.normalizedVertices_; + bitField0_ = (bitField0_ & ~0x00000002); + normalizedVerticesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getNormalizedVerticesFieldBuilder() + : null; + } else { + normalizedVerticesBuilder_.addAllMessages(other.normalizedVertices_); + } + } + } + this.mergeUnknownFields(other.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.v1beta1.BoundingPoly parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.documentai.v1beta1.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.v1beta1.Vertex, + com.google.cloud.documentai.v1beta1.Vertex.Builder, + com.google.cloud.documentai.v1beta1.VertexOrBuilder> + verticesBuilder_; + + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public java.util.List getVerticesList() { + if (verticesBuilder_ == null) { + return java.util.Collections.unmodifiableList(vertices_); + } else { + return verticesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public int getVerticesCount() { + if (verticesBuilder_ == null) { + return vertices_.size(); + } else { + return verticesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta1.Vertex getVertices(int index) { + if (verticesBuilder_ == null) { + return vertices_.get(index); + } else { + return verticesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder setVertices(int index, com.google.cloud.documentai.v1beta1.Vertex value) { + if (verticesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVerticesIsMutable(); + vertices_.set(index, value); + onChanged(); + } else { + verticesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder setVertices( + int index, com.google.cloud.documentai.v1beta1.Vertex.Builder builderForValue) { + if (verticesBuilder_ == null) { + ensureVerticesIsMutable(); + vertices_.set(index, builderForValue.build()); + onChanged(); + } else { + verticesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder addVertices(com.google.cloud.documentai.v1beta1.Vertex value) { + if (verticesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVerticesIsMutable(); + vertices_.add(value); + onChanged(); + } else { + verticesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder addVertices(int index, com.google.cloud.documentai.v1beta1.Vertex value) { + if (verticesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureVerticesIsMutable(); + vertices_.add(index, value); + onChanged(); + } else { + verticesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder addVertices(com.google.cloud.documentai.v1beta1.Vertex.Builder builderForValue) { + if (verticesBuilder_ == null) { + ensureVerticesIsMutable(); + vertices_.add(builderForValue.build()); + onChanged(); + } else { + verticesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder addVertices( + int index, com.google.cloud.documentai.v1beta1.Vertex.Builder builderForValue) { + if (verticesBuilder_ == null) { + ensureVerticesIsMutable(); + vertices_.add(index, builderForValue.build()); + onChanged(); + } else { + verticesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder addAllVertices( + java.lang.Iterable values) { + if (verticesBuilder_ == null) { + ensureVerticesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, vertices_); + onChanged(); + } else { + verticesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder clearVertices() { + if (verticesBuilder_ == null) { + vertices_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + verticesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public Builder removeVertices(int index) { + if (verticesBuilder_ == null) { + ensureVerticesIsMutable(); + vertices_.remove(index); + onChanged(); + } else { + verticesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta1.Vertex.Builder getVerticesBuilder(int index) { + return getVerticesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta1.VertexOrBuilder getVerticesOrBuilder(int index) { + if (verticesBuilder_ == null) { + return vertices_.get(index); + } else { + return verticesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public java.util.List + getVerticesOrBuilderList() { + if (verticesBuilder_ != null) { + return verticesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(vertices_); + } + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta1.Vertex.Builder addVerticesBuilder() { + return getVerticesFieldBuilder() + .addBuilder(com.google.cloud.documentai.v1beta1.Vertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public com.google.cloud.documentai.v1beta1.Vertex.Builder addVerticesBuilder(int index) { + return getVerticesFieldBuilder() + .addBuilder(index, com.google.cloud.documentai.v1beta1.Vertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + public java.util.List + getVerticesBuilderList() { + return getVerticesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Vertex, + com.google.cloud.documentai.v1beta1.Vertex.Builder, + com.google.cloud.documentai.v1beta1.VertexOrBuilder> + getVerticesFieldBuilder() { + if (verticesBuilder_ == null) { + verticesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Vertex, + com.google.cloud.documentai.v1beta1.Vertex.Builder, + com.google.cloud.documentai.v1beta1.VertexOrBuilder>( + vertices_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + vertices_ = null; + } + return verticesBuilder_; + } + + private java.util.List + normalizedVertices_ = java.util.Collections.emptyList(); + + private void ensureNormalizedVerticesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + normalizedVertices_ = + new java.util.ArrayList( + normalizedVertices_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.NormalizedVertex, + com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder, + com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder> + normalizedVerticesBuilder_; + + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public java.util.List + getNormalizedVerticesList() { + if (normalizedVerticesBuilder_ == null) { + return java.util.Collections.unmodifiableList(normalizedVertices_); + } else { + return normalizedVerticesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public int getNormalizedVerticesCount() { + if (normalizedVerticesBuilder_ == null) { + return normalizedVertices_.size(); + } else { + return normalizedVerticesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta1.NormalizedVertex getNormalizedVertices(int index) { + if (normalizedVerticesBuilder_ == null) { + return normalizedVertices_.get(index); + } else { + return normalizedVerticesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder setNormalizedVertices( + int index, com.google.cloud.documentai.v1beta1.NormalizedVertex value) { + if (normalizedVerticesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.set(index, value); + onChanged(); + } else { + normalizedVerticesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder setNormalizedVertices( + int index, com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder builderForValue) { + if (normalizedVerticesBuilder_ == null) { + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.set(index, builderForValue.build()); + onChanged(); + } else { + normalizedVerticesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + com.google.cloud.documentai.v1beta1.NormalizedVertex value) { + if (normalizedVerticesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.add(value); + onChanged(); + } else { + normalizedVerticesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + int index, com.google.cloud.documentai.v1beta1.NormalizedVertex value) { + if (normalizedVerticesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.add(index, value); + onChanged(); + } else { + normalizedVerticesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder builderForValue) { + if (normalizedVerticesBuilder_ == null) { + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.add(builderForValue.build()); + onChanged(); + } else { + normalizedVerticesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addNormalizedVertices( + int index, com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder builderForValue) { + if (normalizedVerticesBuilder_ == null) { + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.add(index, builderForValue.build()); + onChanged(); + } else { + normalizedVerticesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder addAllNormalizedVertices( + java.lang.Iterable values) { + if (normalizedVerticesBuilder_ == null) { + ensureNormalizedVerticesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, normalizedVertices_); + onChanged(); + } else { + normalizedVerticesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder clearNormalizedVertices() { + if (normalizedVerticesBuilder_ == null) { + normalizedVertices_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + normalizedVerticesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public Builder removeNormalizedVertices(int index) { + if (normalizedVerticesBuilder_ == null) { + ensureNormalizedVerticesIsMutable(); + normalizedVertices_.remove(index); + onChanged(); + } else { + normalizedVerticesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder + getNormalizedVerticesBuilder(int index) { + return getNormalizedVerticesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder + getNormalizedVerticesOrBuilder(int index) { + if (normalizedVerticesBuilder_ == null) { + return normalizedVertices_.get(index); + } else { + return normalizedVerticesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public java.util.List + getNormalizedVerticesOrBuilderList() { + if (normalizedVerticesBuilder_ != null) { + return normalizedVerticesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(normalizedVertices_); + } + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder + addNormalizedVerticesBuilder() { + return getNormalizedVerticesFieldBuilder() + .addBuilder(com.google.cloud.documentai.v1beta1.NormalizedVertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder + addNormalizedVerticesBuilder(int index) { + return getNormalizedVerticesFieldBuilder() + .addBuilder( + index, com.google.cloud.documentai.v1beta1.NormalizedVertex.getDefaultInstance()); + } + /** + * + * + *
+     * The bounding polygon normalized vertices.
+     * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + public java.util.List + getNormalizedVerticesBuilderList() { + return getNormalizedVerticesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.NormalizedVertex, + com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder, + com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder> + getNormalizedVerticesFieldBuilder() { + if (normalizedVerticesBuilder_ == null) { + normalizedVerticesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.documentai.v1beta1.NormalizedVertex, + com.google.cloud.documentai.v1beta1.NormalizedVertex.Builder, + com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder>( + normalizedVertices_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + normalizedVertices_ = null; + } + return normalizedVerticesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.BoundingPoly) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.BoundingPoly) + private static final com.google.cloud.documentai.v1beta1.BoundingPoly DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.BoundingPoly(); + } + + public static com.google.cloud.documentai.v1beta1.BoundingPoly getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BoundingPoly parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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.v1beta1.BoundingPoly getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPolyOrBuilder.java b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPolyOrBuilder.java new file mode 100644 index 00000000..d723c63f --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/BoundingPolyOrBuilder.java @@ -0,0 +1,135 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/documentai/v1beta1/geometry.proto + +package com.google.cloud.documentai.v1beta1; + +public interface BoundingPolyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.BoundingPoly) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + java.util.List getVerticesList(); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + com.google.cloud.documentai.v1beta1.Vertex getVertices(int index); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + int getVerticesCount(); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + java.util.List + getVerticesOrBuilderList(); + /** + * + * + *
+   * The bounding polygon vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.Vertex vertices = 1; + */ + com.google.cloud.documentai.v1beta1.VertexOrBuilder getVerticesOrBuilder(int index); + + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + java.util.List getNormalizedVerticesList(); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + com.google.cloud.documentai.v1beta1.NormalizedVertex getNormalizedVertices(int index); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + int getNormalizedVerticesCount(); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + java.util.List + getNormalizedVerticesOrBuilderList(); + /** + * + * + *
+   * The bounding polygon normalized vertices.
+   * 
+ * + * repeated .google.cloud.documentai.v1beta1.NormalizedVertex normalized_vertices = 2; + * + */ + com.google.cloud.documentai.v1beta1.NormalizedVertexOrBuilder getNormalizedVerticesOrBuilder( + int index); +} diff --git a/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/Document.java b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/Document.java new file mode 100644 index 00000000..4ee88f08 --- /dev/null +++ b/proto-google-cloud-documentai-v1beta1/src/main/java/com/google/cloud/documentai/v1beta1/Document.java @@ -0,0 +1,36912 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/documentai/v1beta1/document.proto + +package com.google.cloud.documentai.v1beta1; + +/** + * + * + *
+ * Document represents the canonical document resource in Document Understanding
+ * AI.
+ * It is an interchange format that provides insights into documents and allows
+ * for collaboration between users and Document Understanding AI to iterate and
+ * optimize for quality.
+ * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.Document} + */ +public final class Document extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document) + DocumentOrBuilder { + private static final long serialVersionUID = 0L; + // Use Document.newBuilder() to construct. + private Document(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Document() { + mimeType_ = ""; + text_ = ""; + textStyles_ = java.util.Collections.emptyList(); + pages_ = java.util.Collections.emptyList(); + entities_ = java.util.Collections.emptyList(); + entityRelations_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + 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_ & 0x00000010) != 0)) { + textStyles_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000010; + } + textStyles_.add( + input.readMessage( + com.google.cloud.documentai.v1beta1.Document.Style.parser(), + extensionRegistry)); + break; + } + case 50: + { + if (!((mutable_bitField0_ & 0x00000020) != 0)) { + pages_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + pages_.add( + input.readMessage( + com.google.cloud.documentai.v1beta1.Document.Page.parser(), + extensionRegistry)); + break; + } + case 58: + { + if (!((mutable_bitField0_ & 0x00000040) != 0)) { + entities_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000040; + } + entities_.add( + input.readMessage( + com.google.cloud.documentai.v1beta1.Document.Entity.parser(), + extensionRegistry)); + break; + } + case 66: + { + if (!((mutable_bitField0_ & 0x00000080) != 0)) { + entityRelations_ = + new java.util.ArrayList< + com.google.cloud.documentai.v1beta1.Document.EntityRelation>(); + mutable_bitField0_ |= 0x00000080; + } + entityRelations_.add( + input.readMessage( + com.google.cloud.documentai.v1beta1.Document.EntityRelation.parser(), + extensionRegistry)); + break; + } + case 74: + { + com.google.cloud.documentai.v1beta1.Document.ShardInfo.Builder subBuilder = null; + if (shardInfo_ != null) { + subBuilder = shardInfo_.toBuilder(); + } + shardInfo_ = + input.readMessage( + com.google.cloud.documentai.v1beta1.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; + } + 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_ & 0x00000010) != 0)) { + textStyles_ = java.util.Collections.unmodifiableList(textStyles_); + } + if (((mutable_bitField0_ & 0x00000020) != 0)) { + pages_ = java.util.Collections.unmodifiableList(pages_); + } + if (((mutable_bitField0_ & 0x00000040) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + } + if (((mutable_bitField0_ & 0x00000080) != 0)) { + entityRelations_ = java.util.Collections.unmodifiableList(entityRelations_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.Document.class, + com.google.cloud.documentai.v1beta1.Document.Builder.class); + } + + public interface ShardInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.Document.ShardInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * The 0-based index of this shard.
+     * 
+ * + * int64 shard_index = 1; + */ + long getShardIndex(); + + /** + * + * + *
+     * Total number of shards.
+     * 
+ * + * int64 shard_count = 2; + */ + long getShardCount(); + + /** + * + * + *
+     * The index of the first character in
+     * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
+     * overall document global text.
+     * 
+ * + * int64 text_offset = 3; + */ + long getTextOffset(); + } + /** + * + * + *
+   * For a large document, sharding may be performed to produce several
+   * document shards. Each document shard contains this field to detail which
+   * shard it is.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.Document.ShardInfo} + */ + public static final class ShardInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document.ShardInfo) + ShardInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use ShardInfo.newBuilder() to construct. + private ShardInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ShardInfo() {} + + @java.lang.Override + 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(); + } + 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: + { + 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.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.Document.ShardInfo.class, + com.google.cloud.documentai.v1beta1.Document.ShardInfo.Builder.class); + } + + public static final int SHARD_INDEX_FIELD_NUMBER = 1; + private long shardIndex_; + /** + * + * + *
+     * The 0-based index of this shard.
+     * 
+ * + * int64 shard_index = 1; + */ + 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; + */ + 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.v1beta1.Document.text] in the
+     * overall document global text.
+     * 
+ * + * int64 text_offset = 3; + */ + 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.v1beta1.Document.ShardInfo)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta1.Document.ShardInfo other = + (com.google.cloud.documentai.v1beta1.Document.ShardInfo) obj; + + if (getShardIndex() != other.getShardIndex()) return false; + if (getShardCount() != other.getShardCount()) return false; + if (getTextOffset() != other.getTextOffset()) return false; + if (!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.v1beta1.Document.ShardInfo parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.documentai.v1beta1.Document.ShardInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * For a large document, sharding may be performed to produce several
+     * document shards. Each document shard contains this field to detail which
+     * shard it is.
+     * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.Document.ShardInfo} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.Document.ShardInfo) + com.google.cloud.documentai.v1beta1.Document.ShardInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.Document.ShardInfo.class, + com.google.cloud.documentai.v1beta1.Document.ShardInfo.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta1.Document.ShardInfo.newBuilder() + private Builder() { + 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.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_ShardInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.ShardInfo getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta1.Document.ShardInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.ShardInfo build() { + com.google.cloud.documentai.v1beta1.Document.ShardInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.ShardInfo buildPartial() { + com.google.cloud.documentai.v1beta1.Document.ShardInfo result = + new com.google.cloud.documentai.v1beta1.Document.ShardInfo(this); + 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.v1beta1.Document.ShardInfo) { + return mergeFrom((com.google.cloud.documentai.v1beta1.Document.ShardInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta1.Document.ShardInfo other) { + if (other == com.google.cloud.documentai.v1beta1.Document.ShardInfo.getDefaultInstance()) + return this; + if (other.getShardIndex() != 0L) { + setShardIndex(other.getShardIndex()); + } + if (other.getShardCount() != 0L) { + setShardCount(other.getShardCount()); + } + if (other.getTextOffset() != 0L) { + setTextOffset(other.getTextOffset()); + } + this.mergeUnknownFields(other.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.v1beta1.Document.ShardInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta1.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; + */ + public long getShardIndex() { + return shardIndex_; + } + /** + * + * + *
+       * The 0-based index of this shard.
+       * 
+ * + * int64 shard_index = 1; + */ + public Builder setShardIndex(long value) { + + shardIndex_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The 0-based index of this shard.
+       * 
+ * + * int64 shard_index = 1; + */ + public Builder clearShardIndex() { + + shardIndex_ = 0L; + onChanged(); + return this; + } + + private long shardCount_; + /** + * + * + *
+       * Total number of shards.
+       * 
+ * + * int64 shard_count = 2; + */ + public long getShardCount() { + return shardCount_; + } + /** + * + * + *
+       * Total number of shards.
+       * 
+ * + * int64 shard_count = 2; + */ + public Builder setShardCount(long value) { + + shardCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Total number of shards.
+       * 
+ * + * int64 shard_count = 2; + */ + public Builder clearShardCount() { + + shardCount_ = 0L; + onChanged(); + return this; + } + + private long textOffset_; + /** + * + * + *
+       * The index of the first character in
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
+       * overall document global text.
+       * 
+ * + * int64 text_offset = 3; + */ + public long getTextOffset() { + return textOffset_; + } + /** + * + * + *
+       * The index of the first character in
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
+       * overall document global text.
+       * 
+ * + * int64 text_offset = 3; + */ + public Builder setTextOffset(long value) { + + textOffset_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The index of the first character in
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text] in the
+       * overall document global text.
+       * 
+ * + * int64 text_offset = 3; + */ + 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.v1beta1.Document.ShardInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.Document.ShardInfo) + private static final com.google.cloud.documentai.v1beta1.Document.ShardInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.Document.ShardInfo(); + } + + public static com.google.cloud.documentai.v1beta1.Document.ShardInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ShardInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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.v1beta1.Document.ShardInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface StyleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.Document.Style) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Text anchor indexing into the
+     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + boolean hasTextAnchor(); + /** + * + * + *
+     * Text anchor indexing into the
+     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + com.google.cloud.documentai.v1beta1.Document.TextAnchor getTextAnchor(); + /** + * + * + *
+     * Text anchor indexing into the
+     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder getTextAnchorOrBuilder(); + + /** + * + * + *
+     * Text color.
+     * 
+ * + * .google.type.Color color = 2; + */ + boolean hasColor(); + /** + * + * + *
+     * Text color.
+     * 
+ * + * .google.type.Color color = 2; + */ + 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; + */ + boolean hasBackgroundColor(); + /** + * + * + *
+     * Text background color.
+     * 
+ * + * .google.type.Color background_color = 3; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + com.google.protobuf.ByteString getTextDecorationBytes(); + + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + boolean hasFontSize(); + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + com.google.cloud.documentai.v1beta1.Document.Style.FontSize getFontSize(); + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder getFontSizeOrBuilder(); + } + /** + * + * + *
+   * Annotation for common text style attributes. This adheres to CSS
+   * conventions as much as possible.
+   * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style} + */ + public static final class Style extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document.Style) + StyleOrBuilder { + private static final long serialVersionUID = 0L; + // Use Style.newBuilder() to construct. + private Style(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Style() { + fontWeight_ = ""; + textStyle_ = ""; + textDecoration_ = ""; + } + + @java.lang.Override + 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(); + } + 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: + { + com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder subBuilder = null; + if (textAnchor_ != null) { + subBuilder = textAnchor_.toBuilder(); + } + textAnchor_ = + input.readMessage( + com.google.cloud.documentai.v1beta1.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.v1beta1.Document.Style.FontSize.Builder subBuilder = + null; + if (fontSize_ != null) { + subBuilder = fontSize_.toBuilder(); + } + fontSize_ = + input.readMessage( + com.google.cloud.documentai.v1beta1.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.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.Document.Style.class, + com.google.cloud.documentai.v1beta1.Document.Style.Builder.class); + } + + public interface FontSizeOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.documentai.v1beta1.Document.Style.FontSize) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+       * Font size for the text.
+       * 
+ * + * float size = 1; + */ + float getSize(); + + /** + * + * + *
+       * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
+       * 
+ * + * string unit = 2; + */ + java.lang.String getUnit(); + /** + * + * + *
+       * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
+       * 
+ * + * string unit = 2; + */ + com.google.protobuf.ByteString getUnitBytes(); + } + /** + * + * + *
+     * Font size with unit.
+     * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style.FontSize} + */ + public static final class FontSize extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.documentai.v1beta1.Document.Style.FontSize) + FontSizeOrBuilder { + private static final long serialVersionUID = 0L; + // Use FontSize.newBuilder() to construct. + private FontSize(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private FontSize() { + unit_ = ""; + } + + @java.lang.Override + 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(); + } + 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 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.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.class, + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder.class); + } + + public static final int SIZE_FIELD_NUMBER = 1; + private float size_; + /** + * + * + *
+       * Font size for the text.
+       * 
+ * + * float size = 1; + */ + 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; + */ + 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; + */ + 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.v1beta1.Document.Style.FontSize)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta1.Document.Style.FontSize other = + (com.google.cloud.documentai.v1beta1.Document.Style.FontSize) obj; + + if (java.lang.Float.floatToIntBits(getSize()) + != java.lang.Float.floatToIntBits(other.getSize())) return false; + if (!getUnit().equals(other.getUnit())) return false; + if (!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.v1beta1.Document.Style.FontSize parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.documentai.v1beta1.Document.Style.FontSize prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+       * Font size with unit.
+       * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style.FontSize} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.Document.Style.FontSize) + com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.class, + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta1.Document.Style.FontSize.newBuilder() + private Builder() { + 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.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_FontSize_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.Style.FontSize + getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.Style.FontSize build() { + com.google.cloud.documentai.v1beta1.Document.Style.FontSize result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.Style.FontSize buildPartial() { + com.google.cloud.documentai.v1beta1.Document.Style.FontSize result = + new com.google.cloud.documentai.v1beta1.Document.Style.FontSize(this); + 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.v1beta1.Document.Style.FontSize) { + return mergeFrom((com.google.cloud.documentai.v1beta1.Document.Style.FontSize) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.documentai.v1beta1.Document.Style.FontSize other) { + if (other + == com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance()) + return this; + if (other.getSize() != 0F) { + setSize(other.getSize()); + } + if (!other.getUnit().isEmpty()) { + unit_ = other.unit_; + 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.v1beta1.Document.Style.FontSize parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta1.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; + */ + public float getSize() { + return size_; + } + /** + * + * + *
+         * Font size for the text.
+         * 
+ * + * float size = 1; + */ + public Builder setSize(float value) { + + size_ = value; + onChanged(); + return this; + } + /** + * + * + *
+         * Font size for the text.
+         * 
+ * + * float size = 1; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + public Builder clearUnit() { + + unit_ = getDefaultInstance().getUnit(); + onChanged(); + return this; + } + /** + * + * + *
+         * Unit for the font size. Follows CSS naming (in, px, pt, etc.).
+         * 
+ * + * string unit = 2; + */ + 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.v1beta1.Document.Style.FontSize) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.Document.Style.FontSize) + private static final com.google.cloud.documentai.v1beta1.Document.Style.FontSize + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.Document.Style.FontSize(); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style.FontSize + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public FontSize parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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.v1beta1.Document.Style.FontSize + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int TEXT_ANCHOR_FIELD_NUMBER = 1; + private com.google.cloud.documentai.v1beta1.Document.TextAnchor textAnchor_; + /** + * + * + *
+     * Text anchor indexing into the
+     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public boolean hasTextAnchor() { + return textAnchor_ != null; + } + /** + * + * + *
+     * Text anchor indexing into the
+     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public com.google.cloud.documentai.v1beta1.Document.TextAnchor getTextAnchor() { + return textAnchor_ == null + ? com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance() + : textAnchor_; + } + /** + * + * + *
+     * Text anchor indexing into the
+     * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public com.google.cloud.documentai.v1beta1.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; + */ + public boolean hasColor() { + return color_ != null; + } + /** + * + * + *
+     * Text color.
+     * 
+ * + * .google.type.Color color = 2; + */ + public com.google.type.Color getColor() { + return color_ == null ? com.google.type.Color.getDefaultInstance() : color_; + } + /** + * + * + *
+     * Text color.
+     * 
+ * + * .google.type.Color color = 2; + */ + 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; + */ + public boolean hasBackgroundColor() { + return backgroundColor_ != null; + } + /** + * + * + *
+     * Text background color.
+     * 
+ * + * .google.type.Color background_color = 3; + */ + public com.google.type.Color getBackgroundColor() { + return backgroundColor_ == null + ? com.google.type.Color.getDefaultInstance() + : backgroundColor_; + } + /** + * + * + *
+     * Text background color.
+     * 
+ * + * .google.type.Color background_color = 3; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + public com.google.protobuf.ByteString getTextDecorationBytes() { + java.lang.Object ref = textDecoration_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + textDecoration_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FONT_SIZE_FIELD_NUMBER = 7; + private com.google.cloud.documentai.v1beta1.Document.Style.FontSize fontSize_; + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public boolean hasFontSize() { + return fontSize_ != null; + } + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public com.google.cloud.documentai.v1beta1.Document.Style.FontSize getFontSize() { + return fontSize_ == null + ? com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance() + : fontSize_; + } + /** + * + * + *
+     * Font size.
+     * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public com.google.cloud.documentai.v1beta1.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.v1beta1.Document.Style)) { + return super.equals(obj); + } + com.google.cloud.documentai.v1beta1.Document.Style other = + (com.google.cloud.documentai.v1beta1.Document.Style) obj; + + if (hasTextAnchor() != other.hasTextAnchor()) return false; + if (hasTextAnchor()) { + if (!getTextAnchor().equals(other.getTextAnchor())) return false; + } + if (hasColor() != other.hasColor()) return false; + if (hasColor()) { + if (!getColor().equals(other.getColor())) return false; + } + if (hasBackgroundColor() != other.hasBackgroundColor()) return false; + if (hasBackgroundColor()) { + if (!getBackgroundColor().equals(other.getBackgroundColor())) return false; + } + if (!getFontWeight().equals(other.getFontWeight())) return false; + if (!getTextStyle().equals(other.getTextStyle())) return false; + if (!getTextDecoration().equals(other.getTextDecoration())) return false; + if (hasFontSize() != other.hasFontSize()) return false; + if (hasFontSize()) { + if (!getFontSize().equals(other.getFontSize())) return false; + } + if (!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.v1beta1.Document.Style parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.documentai.v1beta1.Document.Style prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * Annotation for common text style attributes. This adheres to CSS
+     * conventions as much as possible.
+     * 
+ * + * Protobuf type {@code google.cloud.documentai.v1beta1.Document.Style} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.documentai.v1beta1.Document.Style) + com.google.cloud.documentai.v1beta1.Document.StyleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.documentai.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.documentai.v1beta1.Document.Style.class, + com.google.cloud.documentai.v1beta1.Document.Style.Builder.class); + } + + // Construct using com.google.cloud.documentai.v1beta1.Document.Style.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @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.v1beta1.DocumentProto + .internal_static_google_cloud_documentai_v1beta1_Document_Style_descriptor; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.Style getDefaultInstanceForType() { + return com.google.cloud.documentai.v1beta1.Document.Style.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.Style build() { + com.google.cloud.documentai.v1beta1.Document.Style result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.documentai.v1beta1.Document.Style buildPartial() { + com.google.cloud.documentai.v1beta1.Document.Style result = + new com.google.cloud.documentai.v1beta1.Document.Style(this); + if (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.v1beta1.Document.Style) { + return mergeFrom((com.google.cloud.documentai.v1beta1.Document.Style) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.documentai.v1beta1.Document.Style other) { + if (other == com.google.cloud.documentai.v1beta1.Document.Style.getDefaultInstance()) + return this; + if (other.hasTextAnchor()) { + mergeTextAnchor(other.getTextAnchor()); + } + if (other.hasColor()) { + mergeColor(other.getColor()); + } + if (other.hasBackgroundColor()) { + mergeBackgroundColor(other.getBackgroundColor()); + } + if (!other.getFontWeight().isEmpty()) { + fontWeight_ = other.fontWeight_; + 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.v1beta1.Document.Style parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.documentai.v1beta1.Document.Style) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.documentai.v1beta1.Document.TextAnchor textAnchor_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Document.TextAnchor, + com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder, + com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder> + textAnchorBuilder_; + /** + * + * + *
+       * Text anchor indexing into the
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public boolean hasTextAnchor() { + return textAnchorBuilder_ != null || textAnchor_ != null; + } + /** + * + * + *
+       * Text anchor indexing into the
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public com.google.cloud.documentai.v1beta1.Document.TextAnchor getTextAnchor() { + if (textAnchorBuilder_ == null) { + return textAnchor_ == null + ? com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance() + : textAnchor_; + } else { + return textAnchorBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Text anchor indexing into the
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public Builder setTextAnchor(com.google.cloud.documentai.v1beta1.Document.TextAnchor value) { + if (textAnchorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + textAnchor_ = value; + onChanged(); + } else { + textAnchorBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Text anchor indexing into the
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public Builder setTextAnchor( + com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder builderForValue) { + if (textAnchorBuilder_ == null) { + textAnchor_ = builderForValue.build(); + onChanged(); + } else { + textAnchorBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Text anchor indexing into the
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public Builder mergeTextAnchor( + com.google.cloud.documentai.v1beta1.Document.TextAnchor value) { + if (textAnchorBuilder_ == null) { + if (textAnchor_ != null) { + textAnchor_ = + com.google.cloud.documentai.v1beta1.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.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.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.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder + getTextAnchorBuilder() { + + onChanged(); + return getTextAnchorFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Text anchor indexing into the
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + public com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder + getTextAnchorOrBuilder() { + if (textAnchorBuilder_ != null) { + return textAnchorBuilder_.getMessageOrBuilder(); + } else { + return textAnchor_ == null + ? com.google.cloud.documentai.v1beta1.Document.TextAnchor.getDefaultInstance() + : textAnchor_; + } + } + /** + * + * + *
+       * Text anchor indexing into the
+       * [Document.text][google.cloud.documentai.v1beta1.Document.text].
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.TextAnchor text_anchor = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Document.TextAnchor, + com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder, + com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder> + getTextAnchorFieldBuilder() { + if (textAnchorBuilder_ == null) { + textAnchorBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Document.TextAnchor, + com.google.cloud.documentai.v1beta1.Document.TextAnchor.Builder, + com.google.cloud.documentai.v1beta1.Document.TextAnchorOrBuilder>( + getTextAnchor(), getParentForChildren(), isClean()); + textAnchor_ = null; + } + return textAnchorBuilder_; + } + + private com.google.type.Color color_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Color, com.google.type.Color.Builder, com.google.type.ColorOrBuilder> + colorBuilder_; + /** + * + * + *
+       * Text color.
+       * 
+ * + * .google.type.Color color = 2; + */ + public boolean hasColor() { + return colorBuilder_ != null || color_ != null; + } + /** + * + * + *
+       * Text color.
+       * 
+ * + * .google.type.Color color = 2; + */ + 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; + */ + public boolean hasBackgroundColor() { + return backgroundColorBuilder_ != null || backgroundColor_ != null; + } + /** + * + * + *
+       * Text background color.
+       * 
+ * + * .google.type.Color background_color = 3; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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; + */ + 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.v1beta1.Document.Style.FontSize fontSize_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Document.Style.FontSize, + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder, + com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder> + fontSizeBuilder_; + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public boolean hasFontSize() { + return fontSizeBuilder_ != null || fontSize_ != null; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public com.google.cloud.documentai.v1beta1.Document.Style.FontSize getFontSize() { + if (fontSizeBuilder_ == null) { + return fontSize_ == null + ? com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance() + : fontSize_; + } else { + return fontSizeBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public Builder setFontSize( + com.google.cloud.documentai.v1beta1.Document.Style.FontSize value) { + if (fontSizeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + fontSize_ = value; + onChanged(); + } else { + fontSizeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public Builder setFontSize( + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder builderForValue) { + if (fontSizeBuilder_ == null) { + fontSize_ = builderForValue.build(); + onChanged(); + } else { + fontSizeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public Builder mergeFontSize( + com.google.cloud.documentai.v1beta1.Document.Style.FontSize value) { + if (fontSizeBuilder_ == null) { + if (fontSize_ != null) { + fontSize_ = + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.newBuilder(fontSize_) + .mergeFrom(value) + .buildPartial(); + } else { + fontSize_ = value; + } + onChanged(); + } else { + fontSizeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.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.v1beta1.Document.Style.FontSize font_size = 7; + */ + public com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder + getFontSizeBuilder() { + + onChanged(); + return getFontSizeFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + public com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder + getFontSizeOrBuilder() { + if (fontSizeBuilder_ != null) { + return fontSizeBuilder_.getMessageOrBuilder(); + } else { + return fontSize_ == null + ? com.google.cloud.documentai.v1beta1.Document.Style.FontSize.getDefaultInstance() + : fontSize_; + } + } + /** + * + * + *
+       * Font size.
+       * 
+ * + * .google.cloud.documentai.v1beta1.Document.Style.FontSize font_size = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Document.Style.FontSize, + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder, + com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder> + getFontSizeFieldBuilder() { + if (fontSizeBuilder_ == null) { + fontSizeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.documentai.v1beta1.Document.Style.FontSize, + com.google.cloud.documentai.v1beta1.Document.Style.FontSize.Builder, + com.google.cloud.documentai.v1beta1.Document.Style.FontSizeOrBuilder>( + getFontSize(), getParentForChildren(), isClean()); + fontSize_ = null; + } + return fontSizeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.documentai.v1beta1.Document.Style) + } + + // @@protoc_insertion_point(class_scope:google.cloud.documentai.v1beta1.Document.Style) + private static final com.google.cloud.documentai.v1beta1.Document.Style DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.documentai.v1beta1.Document.Style(); + } + + public static com.google.cloud.documentai.v1beta1.Document.Style getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser