diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index db2d8ad1..00000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,13 +0,0 @@ -# Code owners file. -# This file controls who is tagged for review for any given pull request. - -# For syntax help see: -# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax - -* @googleapis/yoshi-java - -# The java-samples-reviewers team is the default owner for samples changes -samples/**/*.java @googleapis/java-samples-reviewers - -# Generated snippets should not be owned by samples reviewers -samples/snippets/generated/ @googleapis/yoshi-java diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index bfa0d3df..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -:bus: This library has moved to -[google-cloud-java/java-language]( -https://github.com/googleapis/google-cloud-java/tree/main/java-language). -This repository will be archived in the future. - -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-language/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. 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 deleted file mode 100644 index eee02c5e..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this library - ---- - -:bus: This library has moved to -[google-cloud-java/java-language]( -https://github.com/googleapis/google-cloud-java/tree/main/java-language). -This repository will be archived in the future. - -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 deleted file mode 100644 index 99586903..00000000 --- a/.github/ISSUE_TEMPLATE/support_request.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -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 deleted file mode 100644 index c05124e3..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,10 +0,0 @@ -Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: -- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-language/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea -- [ ] Ensure the tests and linter pass -- [ ] Code coverage does not decrease (if any source code was changed) -- [ ] Appropriate docs were updated (if necessary) - -Fixes # ☕️ - -If you write sample code, please follow the [samples format]( -https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md). diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml deleted file mode 100644 index 4caef688..00000000 --- a/.github/auto-label.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2021 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. -requestsize: - enabled: true diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml deleted file mode 100644 index 2176b054..00000000 --- a/.github/blunderbuss.yml +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration for the Blunderbuss GitHub app. For more info see -# https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss -assign_prs_by: -- labels: - - samples - to: - - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index c8f413b0..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "maven" - directory: "/" - schedule: - interval: "daily" - # Disable version updates for Maven dependencies - open-pull-requests-limit: 0 - - package-ecosystem: "pip" - directory: "/" - schedule: - interval: "daily" - # Disable version updates for pip dependencies - open-pull-requests-limit: 0 \ No newline at end of file diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml deleted file mode 100644 index c644a24e..00000000 --- a/.github/generated-files-bot.yml +++ /dev/null @@ -1,12 +0,0 @@ -externalManifests: -- type: json - file: 'synth.metadata' - jsonpath: '$.generatedFiles[*]' -- type: json - file: '.github/readme/synth.metadata/synth.metadata' - jsonpath: '$.generatedFiles[*]' -ignoreAuthors: -- 'renovate-bot' -- 'yoshi-automation' -- 'release-please[bot]' -- 'gcf-owl-bot[bot]' diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml deleted file mode 100644 index 0501f63f..00000000 --- a/.github/sync-repo-settings.yaml +++ /dev/null @@ -1,42 +0,0 @@ -rebaseMergeAllowed: false -squashMergeAllowed: true -mergeCommitAllowed: false -branchProtectionRules: - - pattern: main - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (8) - - dependencies (11) - - lint - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - OwlBot Post Processor - - 'Kokoro - Test: Java GraalVM Native Image' - - 'Kokoro - Test: Java 17 GraalVM Native Image' - - pattern: java7 - isAdminEnforced: true - requiredApprovingReviewCount: 1 - requiresCodeOwnerReviews: true - requiresStrictStatusChecks: false - requiredStatusCheckContexts: - - dependencies (8) - - dependencies (11) - - lint - - units (7) - - units (8) - - units (11) - - 'Kokoro - Test: Integration' - - cla/google - - OwlBot Post Processor -permissionRules: - - team: yoshi-admins - permission: admin - - team: yoshi-java-admins - permission: admin - - team: yoshi-java - permission: push diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml deleted file mode 100644 index a0ba1f7d..00000000 --- a/.github/trusted-contribution.yml +++ /dev/null @@ -1,3 +0,0 @@ -trustedContributors: -- renovate-bot -- gcf-owl-bot[bot] diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml deleted file mode 100644 index f5fc7d51..00000000 --- a/.github/workflows/approve-readme.yaml +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: auto-merge-readme -jobs: - approve: - runs-on: ubuntu-latest - if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} - script: | - // only approve PRs from yoshi-automation - if (context.payload.pull_request.user.login !== "yoshi-automation") { - return; - } - - // only approve PRs like "chore: release " - if (!context.payload.pull_request.title === "chore: regenerate README") { - return; - } - - // only approve PRs with README.md and synth.metadata changes - const files = new Set( - ( - await github.paginate( - github.pulls.listFiles.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - }) - ) - ).map(file => file.filename) - ); - if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { - return; - } - - // approve README regeneration PR - await github.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Rubber stamped PR!', - pull_number: context.payload.pull_request.number, - event: 'APPROVE' - }); - - // attach automerge label - await github.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ['automerge'] - }); diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml deleted file mode 100644 index 7a106d00..00000000 --- a/.github/workflows/auto-release.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: auto-release -jobs: - approve: - runs-on: ubuntu-latest - if: contains(github.head_ref, 'release-please') - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} - debug: true - script: | - // only approve PRs from release-please[bot] - if (context.payload.pull_request.user.login !== "release-please[bot]") { - return; - } - - // only approve PRs like "chore(main): release " - if ( !context.payload.pull_request.title.startsWith("chore(main): release") ) { - return; - } - - // only approve PRs with pom.xml and versions.txt changes - const filesPromise = github.rest.pulls.listFiles.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - }); - const changed_files = await github.paginate(filesPromise) - - if ( changed_files.length < 1 ) { - console.log( "Not proceeding since PR is empty!" ) - return; - } - - if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { - console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) - return; - } - - // trigger auto-release when - // 1) it is a SNAPSHOT release (auto-generated post regular release) - // 2) there are dependency updates only - // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) - if ( - context.payload.pull_request.body.includes("Fix") || - context.payload.pull_request.body.includes("Build") || - context.payload.pull_request.body.includes("Documentation") || - context.payload.pull_request.body.includes("BREAKING CHANGES") || - context.payload.pull_request.body.includes("Features") - ) { - console.log( "Not auto-releasing since it is not a dependency-update-only release." ); - return; - } - - const promise = github.rest.pulls.list.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open' - }); - const open_pulls = await github.paginate(promise) - - if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { - for ( const pull of open_pulls ) { - if ( pull.title.startsWith("deps: update dependency") ) { - console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); - return; - } - } - } - - // approve release PR - await github.rest.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Rubber stamped release!', - pull_number: context.payload.pull_request.number, - event: 'APPROVE' - }); - - // attach kokoro:force-run and automerge labels - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ['kokoro:force-run', 'automerge'] - }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index e3bb26e3..00000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - push: - branches: - - main - pull_request: -name: ci -jobs: - units: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - java: [8, 11, 17] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: test - windows: - runs-on: windows-latest - steps: - - name: Support longpaths - run: git config --system core.longpaths true - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - run: java -version - - run: .kokoro/build.bat - env: - JOB_TYPE: test - dependencies: - runs-on: ubuntu-latest - strategy: - matrix: - java: [8, 11, 17] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/dependencies.sh - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 11 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: lint - clirr: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: clirr diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml deleted file mode 100644 index 912ed8b2..00000000 --- a/.github/workflows/samples.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2022 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. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: samples -jobs: - checkstyle: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - name: Run checkstyle - run: mvn -P lint --quiet --batch-mode checkstyle:check - working-directory: samples/snippets diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 598779ba..00000000 --- a/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -.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 - -# 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 - -.flattened-pom.xml diff --git a/.kokoro/build.bat b/.kokoro/build.bat deleted file mode 100644 index 067cf4a4..00000000 --- a/.kokoro/build.bat +++ /dev/null @@ -1,18 +0,0 @@ -:: Copyright 2022 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. -:: Github action job to test core java library features on -:: downstream client libraries before they are released. -:: See documentation in type-shell-output.bat - -"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh deleted file mode 100755 index 9f2fbca4..00000000 --- a/.kokoro/build.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/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}/.. - -# include common functions -source ${scriptDir}/common.sh - -# Print out Maven & Java version -mvn -version -echo ${JOB_TYPE} - -# attempt to install 3 times with exponential backoff (starting with 10 seconds) -retry_with_backoff 3 10 \ - mvn install -B -V -ntp \ - -DskipTests=true \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dmaven.javadoc.skip=true \ - -Dgcloud.download.skip=true \ - -T 1C - -# if GOOGLE_APPLICATION_CREDENTIALS 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_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) -fi - -RETURN_CODE=0 -set +e - -case ${JOB_TYPE} in -test) - mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true - RETURN_CODE=$? - ;; -lint) - mvn com.coveo:fmt-maven-plugin:check -B -ntp - RETURN_CODE=$? - ;; -javadoc) - mvn javadoc:javadoc javadoc:test-javadoc -B -ntp - RETURN_CODE=$? - ;; -integration) - mvn -B ${INTEGRATION_TEST_ARGS} \ - -ntp \ - -Penable-integration-tests \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - RETURN_CODE=$? - ;; -graalvm) - # Run Unit and Integration Tests with Native Image - mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test - RETURN_CODE=$? - ;; -graalvm17) - # Run Unit and Integration Tests with Native Image - mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative test - RETURN_CODE=$? - ;; -samples) - SAMPLES_DIR=samples - # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. - if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] - then - SAMPLES_DIR=samples/snapshot - fi - - if [[ -f ${SAMPLES_DIR}/pom.xml ]] - then - for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do - [[ -f "$FILE" ]] || continue - source "$FILE" - done - - pushd ${SAMPLES_DIR} - mvn -B \ - -ntp \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - RETURN_CODE=$? - popd - else - echo "no sample pom.xml found - skipping sample tests" - fi - ;; -clirr) - mvn -B -ntp -Denforcer.skip=true clirr:check - RETURN_CODE=$? - ;; -*) - ;; -esac - -if [ "${REPORT_COVERAGE}" == "true" ] -then - bash ${KOKORO_GFILE_DIR}/codecov.sh -fi - -# fix output location of logs -bash .kokoro/coerce_logs.sh - -if [[ "${ENABLE_FLAKYBOT}" == "true" ]] -then - chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot - ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/java-language -fi - -echo "exiting with ${RETURN_CODE}" -exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh deleted file mode 100755 index 46edbf7f..00000000 --- a/.kokoro/coerce_logs.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/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 - 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 deleted file mode 100644 index 15472d99..00000000 --- a/.kokoro/common.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# 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-language/.kokoro/trampoline.sh" - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/build.sh" -} diff --git a/.kokoro/common.sh b/.kokoro/common.sh deleted file mode 100644 index f8f957af..00000000 --- a/.kokoro/common.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# 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. - -function retry_with_backoff { - attempts_left=$1 - sleep_seconds=$2 - shift 2 - command=$@ - - - # store current flag state - flags=$- - - # allow a failures to continue - set +e - ${command} - exit_code=$? - - # restore "e" flag - if [[ ${flags} =~ e ]] - then set -e - else set +e - fi - - if [[ $exit_code == 0 ]] - then - return 0 - fi - - # failure - if [[ ${attempts_left} > 0 ]] - then - echo "failure (${exit_code}), sleeping ${sleep_seconds}..." - sleep ${sleep_seconds} - new_attempts=$((${attempts_left} - 1)) - new_sleep=$((${sleep_seconds} * 2)) - retry_with_backoff ${new_attempts} ${new_sleep} ${command} - fi - - return $exit_code -} - -## Helper functionss -function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } -function msg() { println "$*" >&2; } -function println() { printf '%s\n' "$(now) $*"; } - -## Helper comment to trigger updated repo dependency release \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg deleted file mode 100644 index 32327b22..00000000 --- a/.kokoro/continuous/common.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# 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-language/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/build.sh" -} - -env_vars: { - key: "JOB_TYPE" - value: "test" -} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg deleted file mode 100644 index 495cc7ba..00000000 --- a/.kokoro/continuous/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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: "REPORT_COVERAGE" - value: "true" -} diff --git a/.kokoro/continuous/propose_release.sh b/.kokoro/continuous/propose_release.sh deleted file mode 100755 index 3a700fb7..00000000 --- a/.kokoro/continuous/propose_release.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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-language \ - --package-name="language" \ - --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 deleted file mode 100755 index bd896024..00000000 --- a/.kokoro/dependencies.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/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 -shopt -s nullglob - -## 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}/.. - -# include common functions -source ${scriptDir}/common.sh - -# Print out Java -java -version -echo $JOB_TYPE - -function determineMavenOpts() { - local javaVersion=$( - # filter down to the version line, then pull out the version between quotes, - # then trim the version number down to its minimal number (removing any - # update or suffix number). - java -version 2>&1 | grep "version" \ - | sed -E 's/^.*"(.*?)".*$/\1/g' \ - | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' - ) - - if [[ $javaVersion == 17* ]] - then - # MaxPermSize is no longer supported as of jdk 17 - echo -n "-Xmx1024m" - else - echo -n "-Xmx1024m -XX:MaxPermSize=128m" - fi -} - -export MAVEN_OPTS=$(determineMavenOpts) - -# this should run maven enforcer -retry_with_backoff 3 10 \ - mvn install -B -V -ntp \ - -DskipTests=true \ - -Dmaven.javadoc.skip=true \ - -Dclirr.skip=true - -mvn -B dependency:analyze -DfailOnWarning=true diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg deleted file mode 100644 index 32327b22..00000000 --- a/.kokoro/nightly/common.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# 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-language/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/build.sh" -} - -env_vars: { - key: "JOB_TYPE" - value: "test" -} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg deleted file mode 100644 index bd0297a3..00000000 --- a/.kokoro/nightly/integration.cfg +++ /dev/null @@ -1,37 +0,0 @@ -# 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" -} -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "false" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/nightly/java11-integration.cfg b/.kokoro/nightly/java11-integration.cfg deleted file mode 100644 index dc51b65e..00000000 --- a/.kokoro/nightly/java11-integration.cfg +++ /dev/null @@ -1,37 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/java11014" -} - -env_vars: { - key: "JOB_TYPE" - value: "integration" -} -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "false" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg deleted file mode 100644 index 709f2b4c..00000000 --- a/.kokoro/nightly/java11.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index cb24f44e..00000000 --- a/.kokoro/nightly/java7.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index b997ec12..00000000 --- a/.kokoro/nightly/java8-osx.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-language/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg deleted file mode 100644 index 3467576b..00000000 --- a/.kokoro/nightly/java8-win.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-language/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg deleted file mode 100644 index 495cc7ba..00000000 --- a/.kokoro/nightly/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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: "REPORT_COVERAGE" - value: "true" -} diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg deleted file mode 100644 index fee6a838..00000000 --- a/.kokoro/nightly/samples.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# 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: "samples" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-docs-samples-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-docs-samples-service-account" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "false" -} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh deleted file mode 100755 index f5251425..00000000 --- a/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# 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 - -function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} -function msg { println "$*" >&2 ;} -function println { printf '%s\n' "$(now) $*" ;} - - -# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: -# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com -SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" -msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" -mkdir -p ${SECRET_LOCATION} -for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") -do - msg "Retrieving secret ${key}" - docker run --entrypoint=gcloud \ - --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ - gcr.io/google.com/cloudsdktool/cloud-sdk \ - secrets versions access latest \ - --project cloud-devrel-kokoro-resources \ - --secret ${key} > \ - "${SECRET_LOCATION}/${key}" - if [[ $? == 0 ]]; then - msg "Secret written to ${SECRET_LOCATION}/${key}" - else - msg "Error retrieving secret ${key}" - fi -done diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg deleted file mode 100644 index ec572442..00000000 --- a/.kokoro/presubmit/clirr.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# 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 deleted file mode 100644 index f1df1a74..00000000 --- a/.kokoro/presubmit/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# 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-language/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.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 deleted file mode 100644 index 4c9512de..00000000 --- a/.kokoro/presubmit/dependencies.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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-language/.kokoro/dependencies.sh" -} diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg deleted file mode 100644 index e20330c3..00000000 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# 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/graalvm17:22.3.0" -} - -env_vars: { - key: "JOB_TYPE" - value: "graalvm17" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg deleted file mode 100644 index 0fd6ba2f..00000000 --- a/.kokoro/presubmit/graalvm-native.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# 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/graalvm:22.3.0" -} - -env_vars: { - key: "JOB_TYPE" - value: "graalvm" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg deleted file mode 100644 index dded67a9..00000000 --- a/.kokoro/presubmit/integration.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# 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" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg deleted file mode 100644 index 709f2b4c..00000000 --- a/.kokoro/presubmit/java11.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index cb24f44e..00000000 --- a/.kokoro/presubmit/java7.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index b997ec12..00000000 --- a/.kokoro/presubmit/java8-osx.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-language/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg deleted file mode 100644 index 3467576b..00000000 --- a/.kokoro/presubmit/java8-win.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-language/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg deleted file mode 100644 index 495cc7ba..00000000 --- a/.kokoro/presubmit/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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: "REPORT_COVERAGE" - value: "true" -} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg deleted file mode 100644 index 2557f21b..00000000 --- a/.kokoro/presubmit/linkage-monitor.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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-language/.kokoro/linkage-monitor.sh" -} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg deleted file mode 100644 index 6d323c8a..00000000 --- a/.kokoro/presubmit/lint.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# 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/samples.cfg b/.kokoro/presubmit/samples.cfg deleted file mode 100644 index 01e09600..00000000 --- a/.kokoro/presubmit/samples.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# 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: "samples" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-docs-samples-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-docs-samples-service-account" -} \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh deleted file mode 100755 index 691cc225..00000000 --- a/.kokoro/readme.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# 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 ${KOKORO_ARTIFACTS_DIR}/github/java-language - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -# Kokoro exposes this as a file, but the scripts expect just a plain variable. -export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) - -# Setup git credentials -echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials -git config --global credential.helper 'store --file ~/.git-credentials' - -python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool - -set +e -python3.6 -m autosynth.synth \ - --repository=googleapis/java-language \ - --synth-file-name=.github/readme/synth.py \ - --metadata-path=.github/readme/synth.metadata \ - --pr-title="chore: regenerate README" \ - --branch-suffix="readme" - -# autosynth returns 28 to signal there are no changes -RETURN_CODE=$? -if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] -then - exit ${RETURN_CODE} -fi diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg deleted file mode 100644 index df993e89..00000000 --- a/.kokoro/release/bump_snapshot.cfg +++ /dev/null @@ -1,53 +0,0 @@ -# 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-language/.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-language/.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 deleted file mode 100755 index 93e355b3..00000000 --- a/.kokoro/release/bump_snapshot.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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-language \ - --package-name="language" \ - --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 deleted file mode 100644 index 15ba45e0..00000000 --- a/.kokoro/release/common.cfg +++ /dev/null @@ -1,49 +0,0 @@ -# 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-language/.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 deleted file mode 100755 index 7f78ee41..00000000 --- a/.kokoro/release/common.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 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 deleted file mode 100644 index 29f8cc29..00000000 --- a/.kokoro/release/drop.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/release/drop.sh" -} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh deleted file mode 100755 index 742ec1a8..00000000 --- a/.kokoro/release/drop.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 - -# 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 deleted file mode 100644 index e90caecd..00000000 --- a/.kokoro/release/promote.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/release/promote.sh" -} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh deleted file mode 100755 index 3cac3d8a..00000000 --- a/.kokoro/release/promote.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 - -# 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 deleted file mode 100644 index 38aef0fc..00000000 --- a/.kokoro/release/publish_javadoc.cfg +++ /dev/null @@ -1,23 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" - -env_vars: { - key: "STAGING_BUCKET" - value: "docs-staging" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.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 deleted file mode 100755 index c82ad4b7..00000000 --- a/.kokoro/release/publish_javadoc.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/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 - -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 --require-hashes -r .kokoro/requirements.txt - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-language -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# build the docs -mvn site -B -q - -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} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg deleted file mode 100644 index 0ffdaa0b..00000000 --- a/.kokoro/release/publish_javadoc11.cfg +++ /dev/null @@ -1,30 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# cloud-rad production -env_vars: { - key: "STAGING_BUCKET_V2" - value: "docs-staging-v2" -} - -# Configure the docker image for kokoro-trampoline -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java11" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/release/publish_javadoc11.sh" -} - -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "docuploader_service_account" - } - } -} - -# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ -gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh deleted file mode 100755 index 2e830792..00000000 --- a/.kokoro/release/publish_javadoc11.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# Copyright 2021 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 - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET_V2 environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-language -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# cloud RAD generation -mvn clean javadoc:aggregate -B -q -P docFX -# include CHANGELOG -cp CHANGELOG.md target/docfx-yml/history.md - -pushd target/docfx-yml - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --xrefs devsite://java/gax \ - --xrefs devsite://java/google-cloud-core \ - --xrefs devsite://java/api-common \ - --xrefs devsite://java/proto-google-common-protos \ - --xrefs devsite://java/google-api-client \ - --xrefs devsite://java/google-http-client \ - --xrefs devsite://java/protobuf \ - --language java - -# upload yml to production bucket -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET_V2} \ - --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg deleted file mode 100644 index 82846877..00000000 --- a/.kokoro/release/snapshot.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/release/snapshot.sh" -} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh deleted file mode 100755 index 1f55b770..00000000 --- a/.kokoro/release/snapshot.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/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 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 deleted file mode 100644 index 19ad0d7c..00000000 --- a/.kokoro/release/stage.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/release/stage.sh" -} - -# Need to save the properties file -action { - define_artifacts { - regex: "github/java-language/target/nexus-staging/staging/*.properties" - strip_prefix: "github/java-language" - } -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" -} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh deleted file mode 100755 index 61e714d6..00000000 --- a/.kokoro/release/stage.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 - -# Start the releasetool reporter -requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) -python3 -m pip install --require-hashes -r $requirementsFile -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -source $(dirname "$0")/common.sh -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" - -# attempt to stage 3 times with exponential backoff (starting with 10 seconds) -retry_with_backoff 3 10 \ - mvn clean deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DskipTests=true \ - -Dclirr.skip=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 diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in deleted file mode 100644 index 2092cc74..00000000 --- a/.kokoro/requirements.in +++ /dev/null @@ -1,6 +0,0 @@ -gcp-docuploader -gcp-releasetool>=1.10.5 # required for compatibility with cryptography>=39.x -wheel -setuptools -typing-extensions -click<8.1.0 \ No newline at end of file diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt deleted file mode 100644 index c80f0a87..00000000 --- a/.kokoro/requirements.txt +++ /dev/null @@ -1,403 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --allow-unsafe --generate-hashes requirements.in -# -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c - # via gcp-releasetool -cachetools==4.2.4 \ - --hash=sha256:89ea6f1b638d5a73a4f9226be57ac5e4f399d22770b92355f92dcb0f7f001693 \ - --hash=sha256:92971d3cb7d2a97efff7c7bb1657f21a8f5fb309a37530537c71b1774189f2d1 - # via google-auth -certifi==2022.12.7 \ - --hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \ - --hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18 - # via requests -cffi==1.15.1 \ - --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ - --hash=sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef \ - --hash=sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104 \ - --hash=sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426 \ - --hash=sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405 \ - --hash=sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375 \ - --hash=sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a \ - --hash=sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e \ - --hash=sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc \ - --hash=sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf \ - --hash=sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185 \ - --hash=sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497 \ - --hash=sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3 \ - --hash=sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35 \ - --hash=sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c \ - --hash=sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83 \ - --hash=sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21 \ - --hash=sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca \ - --hash=sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984 \ - --hash=sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac \ - --hash=sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd \ - --hash=sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee \ - --hash=sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a \ - --hash=sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2 \ - --hash=sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192 \ - --hash=sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7 \ - --hash=sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585 \ - --hash=sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f \ - --hash=sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e \ - --hash=sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27 \ - --hash=sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b \ - --hash=sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e \ - --hash=sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e \ - --hash=sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d \ - --hash=sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c \ - --hash=sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415 \ - --hash=sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82 \ - --hash=sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02 \ - --hash=sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314 \ - --hash=sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325 \ - --hash=sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c \ - --hash=sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3 \ - --hash=sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914 \ - --hash=sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045 \ - --hash=sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d \ - --hash=sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9 \ - --hash=sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5 \ - --hash=sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2 \ - --hash=sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c \ - --hash=sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3 \ - --hash=sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2 \ - --hash=sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8 \ - --hash=sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d \ - --hash=sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d \ - --hash=sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9 \ - --hash=sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162 \ - --hash=sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76 \ - --hash=sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4 \ - --hash=sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e \ - --hash=sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9 \ - --hash=sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6 \ - --hash=sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b \ - --hash=sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01 \ - --hash=sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0 - # via cryptography -charset-normalizer==2.0.12 \ - --hash=sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597 \ - --hash=sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df - # via requests -click==8.0.4 \ - --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ - --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb - # via - # -r requirements.in - # gcp-docuploader - # gcp-releasetool -colorlog==6.7.0 \ - --hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \ - --hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5 - # via gcp-docuploader -cryptography==39.0.1 \ - --hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \ - --hash=sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f \ - --hash=sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502 \ - --hash=sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41 \ - --hash=sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965 \ - --hash=sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e \ - --hash=sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc \ - --hash=sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad \ - --hash=sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505 \ - --hash=sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388 \ - --hash=sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6 \ - --hash=sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2 \ - --hash=sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac \ - --hash=sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695 \ - --hash=sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6 \ - --hash=sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336 \ - --hash=sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0 \ - --hash=sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c \ - --hash=sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106 \ - --hash=sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a \ - --hash=sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8 - # via - # gcp-releasetool - # secretstorage -gcp-docuploader==0.6.4 \ - --hash=sha256:01486419e24633af78fd0167db74a2763974765ee8078ca6eb6964d0ebd388af \ - --hash=sha256:70861190c123d907b3b067da896265ead2eeb9263969d6955c9e0bb091b5ccbf - # via -r requirements.in -gcp-releasetool==1.10.5 \ - --hash=sha256:174b7b102d704b254f2a26a3eda2c684fd3543320ec239baf771542a2e58e109 \ - --hash=sha256:e29d29927fe2ca493105a82958c6873bb2b90d503acac56be2c229e74de0eec9 - # via -r requirements.in -google-api-core==2.8.2 \ - --hash=sha256:06f7244c640322b508b125903bb5701bebabce8832f85aba9335ec00b3d02edc \ - --hash=sha256:93c6a91ccac79079ac6bbf8b74ee75db970cc899278b97d53bc012f35908cf50 - # via - # google-cloud-core - # google-cloud-storage -google-auth==2.14.1 \ - --hash=sha256:ccaa901f31ad5cbb562615eb8b664b3dd0bf5404a67618e642307f00613eda4d \ - --hash=sha256:f5d8701633bebc12e0deea4df8abd8aff31c28b355360597f7f2ee60f2e4d016 - # via - # gcp-releasetool - # google-api-core - # google-cloud-core - # google-cloud-storage -google-cloud-core==2.3.1 \ - --hash=sha256:113ba4f492467d5bd442c8d724c1a25ad7384045c3178369038840ecdd19346c \ - --hash=sha256:34334359cb04187bdc80ddcf613e462dfd7a3aabbc3fe4d118517ab4b9303d53 - # via google-cloud-storage -google-cloud-storage==2.0.0 \ - --hash=sha256:a57a15aead0f9dfbd4381f1bfdbe8bf89818a4bd75bab846cafcefb2db846c47 \ - --hash=sha256:ec4be60bb223a3a960f0d01697d849b86d91cad815a84915a32ed3635e93a5e7 - # via gcp-docuploader -google-crc32c==1.3.0 \ - --hash=sha256:04e7c220798a72fd0f08242bc8d7a05986b2a08a0573396187fd32c1dcdd58b3 \ - --hash=sha256:05340b60bf05b574159e9bd940152a47d38af3fb43803ffe71f11d704b7696a6 \ - --hash=sha256:12674a4c3b56b706153a358eaa1018c4137a5a04635b92b4652440d3d7386206 \ - --hash=sha256:127f9cc3ac41b6a859bd9dc4321097b1a4f6aa7fdf71b4f9227b9e3ebffb4422 \ - --hash=sha256:13af315c3a0eec8bb8b8d80b8b128cb3fcd17d7e4edafc39647846345a3f003a \ - --hash=sha256:1926fd8de0acb9d15ee757175ce7242e235482a783cd4ec711cc999fc103c24e \ - --hash=sha256:226f2f9b8e128a6ca6a9af9b9e8384f7b53a801907425c9a292553a3a7218ce0 \ - --hash=sha256:276de6273eb074a35bc598f8efbc00c7869c5cf2e29c90748fccc8c898c244df \ - --hash=sha256:318f73f5484b5671f0c7f5f63741ab020a599504ed81d209b5c7129ee4667407 \ - --hash=sha256:3bbce1be3687bbfebe29abdb7631b83e6b25da3f4e1856a1611eb21854b689ea \ - --hash=sha256:42ae4781333e331a1743445931b08ebdad73e188fd554259e772556fc4937c48 \ - --hash=sha256:58be56ae0529c664cc04a9c76e68bb92b091e0194d6e3c50bea7e0f266f73713 \ - --hash=sha256:5da2c81575cc3ccf05d9830f9e8d3c70954819ca9a63828210498c0774fda1a3 \ - --hash=sha256:6311853aa2bba4064d0c28ca54e7b50c4d48e3de04f6770f6c60ebda1e975267 \ - --hash=sha256:650e2917660e696041ab3dcd7abac160b4121cd9a484c08406f24c5964099829 \ - --hash=sha256:6a4db36f9721fdf391646685ecffa404eb986cbe007a3289499020daf72e88a2 \ - --hash=sha256:779cbf1ce375b96111db98fca913c1f5ec11b1d870e529b1dc7354b2681a8c3a \ - --hash=sha256:7f6fe42536d9dcd3e2ffb9d3053f5d05221ae3bbcefbe472bdf2c71c793e3183 \ - --hash=sha256:891f712ce54e0d631370e1f4997b3f182f3368179198efc30d477c75d1f44942 \ - --hash=sha256:95c68a4b9b7828ba0428f8f7e3109c5d476ca44996ed9a5f8aac6269296e2d59 \ - --hash=sha256:96a8918a78d5d64e07c8ea4ed2bc44354e3f93f46a4866a40e8db934e4c0d74b \ - --hash=sha256:9c3cf890c3c0ecfe1510a452a165431b5831e24160c5fcf2071f0f85ca5a47cd \ - --hash=sha256:9f58099ad7affc0754ae42e6d87443299f15d739b0ce03c76f515153a5cda06c \ - --hash=sha256:a0b9e622c3b2b8d0ce32f77eba617ab0d6768b82836391e4f8f9e2074582bf02 \ - --hash=sha256:a7f9cbea4245ee36190f85fe1814e2d7b1e5f2186381b082f5d59f99b7f11328 \ - --hash=sha256:bab4aebd525218bab4ee615786c4581952eadc16b1ff031813a2fd51f0cc7b08 \ - --hash=sha256:c124b8c8779bf2d35d9b721e52d4adb41c9bfbde45e6a3f25f0820caa9aba73f \ - --hash=sha256:c9da0a39b53d2fab3e5467329ed50e951eb91386e9d0d5b12daf593973c3b168 \ - --hash=sha256:ca60076c388728d3b6ac3846842474f4250c91efbfe5afa872d3ffd69dd4b318 \ - --hash=sha256:cb6994fff247987c66a8a4e550ef374671c2b82e3c0d2115e689d21e511a652d \ - --hash=sha256:d1c1d6236feab51200272d79b3d3e0f12cf2cbb12b208c835b175a21efdb0a73 \ - --hash=sha256:dd7760a88a8d3d705ff562aa93f8445ead54f58fd482e4f9e2bafb7e177375d4 \ - --hash=sha256:dda4d8a3bb0b50f540f6ff4b6033f3a74e8bf0bd5320b70fab2c03e512a62812 \ - --hash=sha256:e0f1ff55dde0ebcfbef027edc21f71c205845585fffe30d4ec4979416613e9b3 \ - --hash=sha256:e7a539b9be7b9c00f11ef16b55486141bc2cdb0c54762f84e3c6fc091917436d \ - --hash=sha256:eb0b14523758e37802f27b7f8cd973f5f3d33be7613952c0df904b68c4842f0e \ - --hash=sha256:ed447680ff21c14aaceb6a9f99a5f639f583ccfe4ce1a5e1d48eb41c3d6b3217 \ - --hash=sha256:f52a4ad2568314ee713715b1e2d79ab55fab11e8b304fd1462ff5cccf4264b3e \ - --hash=sha256:fbd60c6aaa07c31d7754edbc2334aef50601b7f1ada67a96eb1eb57c7c72378f \ - --hash=sha256:fc28e0db232c62ca0c3600884933178f0825c99be4474cdd645e378a10588125 \ - --hash=sha256:fe31de3002e7b08eb20823b3735b97c86c5926dd0581c7710a680b418a8709d4 \ - --hash=sha256:fec221a051150eeddfdfcff162e6db92c65ecf46cb0f7bb1bf812a1520ec026b \ - --hash=sha256:ff71073ebf0e42258a42a0b34f2c09ec384977e7f6808999102eedd5b49920e3 - # via google-resumable-media -google-resumable-media==2.3.3 \ - --hash=sha256:27c52620bd364d1c8116eaac4ea2afcbfb81ae9139fb3199652fcac1724bfb6c \ - --hash=sha256:5b52774ea7a829a8cdaa8bd2d4c3d4bc660c91b30857ab2668d0eb830f4ea8c5 - # via google-cloud-storage -googleapis-common-protos==1.56.3 \ - --hash=sha256:6f1369b58ed6cf3a4b7054a44ebe8d03b29c309257583a2bbdc064cd1e4a1442 \ - --hash=sha256:87955d7b3a73e6e803f2572a33179de23989ebba725e05ea42f24838b792e461 - # via google-api-core -idna==3.4 \ - --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ - --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 - # via requests -importlib-metadata==4.8.3 \ - --hash=sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e \ - --hash=sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668 - # via keyring -jeepney==0.8.0 \ - --hash=sha256:5efe48d255973902f6badc3ce55e2aa6c5c3b3bc642059ef3a91247bcfcc5806 \ - --hash=sha256:c0a454ad016ca575060802ee4d590dd912e35c122fa04e70306de3d076cce755 - # via - # keyring - # secretstorage -jinja2==3.0.3 \ - --hash=sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8 \ - --hash=sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7 - # via gcp-releasetool -keyring==23.4.1 \ - --hash=sha256:17e49fb0d6883c2b4445359434dba95aad84aabb29bbff044ad0ed7100232eca \ - --hash=sha256:89cbd74d4683ed164c8082fb38619341097741323b3786905c6dac04d6915a55 - # via gcp-releasetool -markupsafe==2.0.1 \ - --hash=sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298 \ - --hash=sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64 \ - --hash=sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b \ - --hash=sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194 \ - --hash=sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567 \ - --hash=sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff \ - --hash=sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724 \ - --hash=sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74 \ - --hash=sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646 \ - --hash=sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35 \ - --hash=sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6 \ - --hash=sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a \ - --hash=sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6 \ - --hash=sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad \ - --hash=sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26 \ - --hash=sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38 \ - --hash=sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac \ - --hash=sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7 \ - --hash=sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6 \ - --hash=sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047 \ - --hash=sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75 \ - --hash=sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f \ - --hash=sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b \ - --hash=sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135 \ - --hash=sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8 \ - --hash=sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a \ - --hash=sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a \ - --hash=sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1 \ - --hash=sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9 \ - --hash=sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864 \ - --hash=sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914 \ - --hash=sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee \ - --hash=sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f \ - --hash=sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18 \ - --hash=sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8 \ - --hash=sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2 \ - --hash=sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d \ - --hash=sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b \ - --hash=sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b \ - --hash=sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86 \ - --hash=sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6 \ - --hash=sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f \ - --hash=sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb \ - --hash=sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833 \ - --hash=sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28 \ - --hash=sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e \ - --hash=sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415 \ - --hash=sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902 \ - --hash=sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f \ - --hash=sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d \ - --hash=sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9 \ - --hash=sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d \ - --hash=sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145 \ - --hash=sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066 \ - --hash=sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c \ - --hash=sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1 \ - --hash=sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a \ - --hash=sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207 \ - --hash=sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f \ - --hash=sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53 \ - --hash=sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd \ - --hash=sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134 \ - --hash=sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85 \ - --hash=sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9 \ - --hash=sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5 \ - --hash=sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94 \ - --hash=sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509 \ - --hash=sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51 \ - --hash=sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872 - # via jinja2 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 - # via gcp-releasetool -protobuf==3.20.2 \ - --hash=sha256:03d76b7bd42ac4a6e109742a4edf81ffe26ffd87c5993126d894fe48a120396a \ - --hash=sha256:09e25909c4297d71d97612f04f41cea8fa8510096864f2835ad2f3b3df5a5559 \ - --hash=sha256:18e34a10ae10d458b027d7638a599c964b030c1739ebd035a1dfc0e22baa3bfe \ - --hash=sha256:291fb4307094bf5ccc29f424b42268640e00d5240bf0d9b86bf3079f7576474d \ - --hash=sha256:2c0b040d0b5d5d207936ca2d02f00f765906622c07d3fa19c23a16a8ca71873f \ - --hash=sha256:384164994727f274cc34b8abd41a9e7e0562801361ee77437099ff6dfedd024b \ - --hash=sha256:3cb608e5a0eb61b8e00fe641d9f0282cd0eedb603be372f91f163cbfbca0ded0 \ - --hash=sha256:5d9402bf27d11e37801d1743eada54372f986a372ec9679673bfcc5c60441151 \ - --hash=sha256:712dca319eee507a1e7df3591e639a2b112a2f4a62d40fe7832a16fd19151750 \ - --hash=sha256:7a5037af4e76c975b88c3becdf53922b5ffa3f2cddf657574a4920a3b33b80f3 \ - --hash=sha256:8228e56a865c27163d5d1d1771d94b98194aa6917bcfb6ce139cbfa8e3c27334 \ - --hash=sha256:84a1544252a933ef07bb0b5ef13afe7c36232a774affa673fc3636f7cee1db6c \ - --hash=sha256:84fe5953b18a383fd4495d375fe16e1e55e0a3afe7b4f7b4d01a3a0649fcda9d \ - --hash=sha256:9c673c8bfdf52f903081816b9e0e612186684f4eb4c17eeb729133022d6032e3 \ - --hash=sha256:a9e5ae5a8e8985c67e8944c23035a0dff2c26b0f5070b2f55b217a1c33bbe8b1 \ - --hash=sha256:b4fdb29c5a7406e3f7ef176b2a7079baa68b5b854f364c21abe327bbeec01cdb \ - --hash=sha256:c184485e0dfba4dfd451c3bd348c2e685d6523543a0f91b9fd4ae90eb09e8422 \ - --hash=sha256:c9cdf251c582c16fd6a9f5e95836c90828d51b0069ad22f463761d27c6c19019 \ - --hash=sha256:e39cf61bb8582bda88cdfebc0db163b774e7e03364bbf9ce1ead13863e81e359 \ - --hash=sha256:e8fbc522303e09036c752a0afcc5c0603e917222d8bedc02813fd73b4b4ed804 \ - --hash=sha256:f34464ab1207114e73bba0794d1257c150a2b89b7a9faf504e00af7c9fd58978 \ - --hash=sha256:f52dabc96ca99ebd2169dadbe018824ebda08a795c7684a0b7d203a290f3adb0 - # via - # gcp-docuploader - # gcp-releasetool - # google-api-core - # google-cloud-storage -pyasn1==0.4.8 \ - --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ - --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba - # via - # pyasn1-modules - # rsa -pyasn1-modules==0.2.8 \ - --hash=sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e \ - --hash=sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74 - # via google-auth -pycparser==2.21 \ - --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \ - --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206 - # via cffi -pyjwt==2.4.0 \ - --hash=sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf \ - --hash=sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba - # via gcp-releasetool -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via packaging -pyperclip==1.8.2 \ - --hash=sha256:105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57 - # via gcp-releasetool -python-dateutil==2.8.2 \ - --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ - --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 - # via gcp-releasetool -requests==2.27.1 \ - --hash=sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61 \ - --hash=sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d - # via - # gcp-releasetool - # google-api-core - # google-cloud-storage -rsa==4.9 \ - --hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \ - --hash=sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21 - # via google-auth -secretstorage==3.3.3 \ - --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ - --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 - # via keyring -setuptools==67.3.2 \ - --hash=sha256:95f00380ef2ffa41d9bba85d95b27689d923c93dfbafed4aecd7cf988a25e012 \ - --hash=sha256:bb6d8e508de562768f2027902929f8523932fcd1fb784e6d573d2cafac995a48 - # via -r requirements.in -six==1.16.0 \ - --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ - --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # gcp-docuploader - # google-auth - # python-dateutil -typing-extensions==4.4.0 \ - --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ - --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e - # via -r requirements.in -urllib3==1.26.12 \ - --hash=sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e \ - --hash=sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997 - # via requests -wheel==0.38.4 \ - --hash=sha256:965f5259b566725405b05e7cf774052044b1ed30119b5d586b2703aafe8719ac \ - --hash=sha256:b60533f3f5d530e971d6737ca6d58681ee434818fab630c83a734bb10c083ce8 - # via -r requirements.in -zipp==3.6.0 \ - --hash=sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832 \ - --hash=sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc - # via importlib-metadata diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh deleted file mode 100644 index 8b69b793..00000000 --- a/.kokoro/trampoline.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 2018 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 -# 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 - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.readme-partials.yaml b/.readme-partials.yaml deleted file mode 100644 index 272901e8..00000000 --- a/.readme-partials.yaml +++ /dev/null @@ -1,33 +0,0 @@ -custom_content: | - #### Analyzing sentiment - With Cloud Natural Language, you can analyze the sentiment of text. Add the following imports at the top of your file: - - ``` java - import com.google.cloud.language.v1.LanguageServiceClient; - import com.google.cloud.language.v1.Document; - import com.google.cloud.language.v1.Document.Type; - import com.google.cloud.language.v1.Sentiment; - ``` - Then, to analyze the sentiment of some text, use the following code: - - ``` java - // Instantiates a client - LanguageServiceClient language = LanguageServiceClient.create(); - - // The text to analyze - String[] texts = {"I love this!", "I hate this!"}; - for (String text : texts) { - Document doc = Document.newBuilder().setContent(text).setType(Type.PLAIN_TEXT).build(); - // Detects the sentiment of the text - Sentiment sentiment = language.analyzeSentiment(doc).getDocumentSentiment(); - - System.out.printf("Text: \"%s\"%n", text); - System.out.printf( - "Sentiment: score = %s, magnitude = %s%n", - sentiment.getScore(), sentiment.getMagnitude()); - } - ``` - - #### Complete source code - - In [AnalyzeSentiment.java](https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-examples/src/main/java/com/google/cloud/examples/language/snippets/AnalyzeSentiment.java) we put the code shown above into a complete program. \ No newline at end of file diff --git a/.repo-metadata.json b/.repo-metadata.json deleted file mode 100644 index 4401b301..00000000 --- a/.repo-metadata.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "api_shortname": "language", - "name_pretty": "Natural Language", - "product_documentation": "https://cloud.google.com/natural-language/docs/", - "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-language/latest/history", - "issue_tracker": "https://issuetracker.google.com/savedsearches/559753", - "release_level": "stable", - "language": "java", - "repo": "googleapis/java-language", - "repo_short": "java-language", - "distribution_name": "com.google.cloud:google-cloud-language", - "api_id": "language.googleapis.com", - "transport": "grpc", - "requires_billing": true, - "api_description": "provides natural language understanding technologies to developers, including sentiment analysis, entity analysis, entity sentiment analysis, content classification, and syntax analysis. This API is part of the larger Cloud Machine Learning API family.", - "library_type": "GAPIC_AUTO" -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 7b0df832..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,498 +0,0 @@ -# Changelog - -## [2.4.1](https://github.com/googleapis/java-language/compare/v2.4.0...v2.4.1) (2022-10-03) - - -### Documentation - -* Update classification sample to use v2 model ([#899](https://github.com/googleapis/java-language/issues/899)) ([7b3a5f8](https://github.com/googleapis/java-language/commit/7b3a5f86b7de401198e74e76ba7af1f1599ae6cc)) - - -### Dependencies - -* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#929](https://github.com/googleapis/java-language/issues/929)) ([805563b](https://github.com/googleapis/java-language/commit/805563b083bb04bfa59ef7fc4418c6950b3340db)) -* Update dependency google-api-core to v2.10.1 ([#921](https://github.com/googleapis/java-language/issues/921)) ([8b39a51](https://github.com/googleapis/java-language/commit/8b39a51acbc452afc2bb045f6d88bbdfc46b81ed)) -* Update dependency google-auth to v2.12.0 ([#922](https://github.com/googleapis/java-language/issues/922)) ([f273003](https://github.com/googleapis/java-language/commit/f273003a294fb2d116c78f25848bd22fa8f18fc8)) -* Update dependency google-cloud-storage to v2.5.0 ([#923](https://github.com/googleapis/java-language/issues/923)) ([c34885b](https://github.com/googleapis/java-language/commit/c34885ba6ad41c8eeeeda2ad9feb20f89f67e589)) -* Update dependency google-crc32c to v1.5.0 ([#924](https://github.com/googleapis/java-language/issues/924)) ([51baceb](https://github.com/googleapis/java-language/commit/51baceb6bf821f3da41569b27cd7cdf745bd1db8)) -* Update dependency importlib-metadata to v4.12.0 ([#925](https://github.com/googleapis/java-language/issues/925)) ([a246f0d](https://github.com/googleapis/java-language/commit/a246f0dcc43ce8faeefdf998011222df294d27fa)) -* Update dependency jeepney to v0.8.0 ([#926](https://github.com/googleapis/java-language/issues/926)) ([04a307a](https://github.com/googleapis/java-language/commit/04a307ad130c3adfb2471aac551ebfc674c0d060)) - -## [2.4.0](https://github.com/googleapis/java-language/compare/v2.3.4...v2.4.0) (2022-09-26) - - -### Features - -* Add support for V1 and V2 classification models for the V1 API ([4148969](https://github.com/googleapis/java-language/commit/41489691955887daa9e00a365be6012ce4a57943)) -* Add support for V1 and V2 classification models for the V1Beta2 API ([#895](https://github.com/googleapis/java-language/issues/895)) ([4148969](https://github.com/googleapis/java-language/commit/41489691955887daa9e00a365be6012ce4a57943)) - - -### Documentation - -* Fix docstring formatting ([#897](https://github.com/googleapis/java-language/issues/897)) ([6267be8](https://github.com/googleapis/java-language/commit/6267be81ff610ef7c0c35320b032260c8b8d5db7)) - -## [2.3.4](https://github.com/googleapis/java-language/compare/v2.3.3...v2.3.4) (2022-09-15) - - -### Dependencies - -* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#890](https://github.com/googleapis/java-language/issues/890)) ([9359998](https://github.com/googleapis/java-language/commit/93599989f1b8ba59bf32c0542a1c537a3bac6a67)) - -## [2.3.3](https://github.com/googleapis/java-language/compare/v2.3.2...v2.3.3) (2022-09-08) - - -### Dependencies - -* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#885](https://github.com/googleapis/java-language/issues/885)) ([cd8a4d0](https://github.com/googleapis/java-language/commit/cd8a4d03904a15cd8994b73f179f5bff391c97fe)) - -## [2.3.2](https://github.com/googleapis/java-language/compare/v2.3.1...v2.3.2) (2022-08-09) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#874](https://github.com/googleapis/java-language/issues/874)) ([685258c](https://github.com/googleapis/java-language/commit/685258c02e634ab8f919d6806a2a3d30027ae6a1)) - -## [2.3.1](https://github.com/googleapis/java-language/compare/v2.3.0...v2.3.1) (2022-07-13) - - -### Bug Fixes - -* enable longpaths support for windows test ([#1485](https://github.com/googleapis/java-language/issues/1485)) ([#868](https://github.com/googleapis/java-language/issues/868)) ([c168587](https://github.com/googleapis/java-language/commit/c1685872ad7c6b28b0055af67ea8b0a1aff6e852)) - -## [2.3.0](https://github.com/googleapis/java-language/compare/v2.2.0...v2.3.0) (2022-07-01) - - -### Features - -* Add Java REST transport to analytics, servicecontrol, servicemanagement, serviceusage and langauge APIs ([7348caf](https://github.com/googleapis/java-language/commit/7348cafcb3df275e66126df0baa237ade8f4a9bd)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#858](https://github.com/googleapis/java-language/issues/858)) ([eb8c97f](https://github.com/googleapis/java-language/commit/eb8c97ff3ae6f7851333032be635becb3ae51961)) - -## [2.2.0](https://github.com/googleapis/java-language/compare/v2.1.11...v2.2.0) (2022-05-24) - - -### Features - -* add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-language/issues/1440)) ([#847](https://github.com/googleapis/java-language/issues/847)) ([a03cdf5](https://github.com/googleapis/java-language/commit/a03cdf5c8c2fe896676513fe56ef0883f568dfdb)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.12.0 ([#846](https://github.com/googleapis/java-language/issues/846)) ([e39dec8](https://github.com/googleapis/java-language/commit/e39dec855d4e0979523758f0bc62d4def75f0cbf)) - -### [2.1.11](https://github.com/googleapis/java-language/compare/v2.1.10...v2.1.11) (2022-04-15) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.10.0 ([#832](https://github.com/googleapis/java-language/issues/832)) ([beb1f1e](https://github.com/googleapis/java-language/commit/beb1f1e2dddb9f0e8eea91c06d29cf15e6b71ef4)) - -### [2.1.10](https://github.com/googleapis/java-language/compare/v2.1.9...v2.1.10) (2022-03-29) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.9.0 ([#825](https://github.com/googleapis/java-language/issues/825)) ([05fcd72](https://github.com/googleapis/java-language/commit/05fcd72c5a789207ce0afa60addef5db96924837)) - -### [2.1.9](https://github.com/googleapis/java-language/compare/v2.1.8...v2.1.9) (2022-03-02) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.8.0 ([#815](https://github.com/googleapis/java-language/issues/815)) ([e2d7bf2](https://github.com/googleapis/java-language/commit/e2d7bf2e9019b5dcbb6c46b4251a66167be50482)) - -### [2.1.8](https://github.com/googleapis/java-language/compare/v2.1.7...v2.1.8) (2022-02-28) - - -### Dependencies - -* update actions/setup-java action to v3 ([#808](https://github.com/googleapis/java-language/issues/808)) ([d0bdffc](https://github.com/googleapis/java-language/commit/d0bdffc7da94c916beb12888569c510f5ed816da)) - -### [2.1.7](https://github.com/googleapis/java-language/compare/v2.1.6...v2.1.7) (2022-02-11) - - -### Dependencies - -* update actions/github-script action to v6 ([#800](https://github.com/googleapis/java-language/issues/800)) ([62ed30a](https://github.com/googleapis/java-language/commit/62ed30ac0d53c2da8df57333e5fccd515556e5da)) - -### [2.1.6](https://github.com/googleapis/java-language/compare/v2.1.5...v2.1.6) (2022-02-03) - - -### Dependencies - -* **java:** update actions/github-script action to v5 ([#1339](https://github.com/googleapis/java-language/issues/1339)) ([#788](https://github.com/googleapis/java-language/issues/788)) ([7eed3fd](https://github.com/googleapis/java-language/commit/7eed3fd1c23001bb091a6c530920d1643bfcedf2)) -* update actions/github-script action to v5 ([#787](https://github.com/googleapis/java-language/issues/787)) ([05adfaf](https://github.com/googleapis/java-language/commit/05adfaf82d26cf59a494c35b355fcb5aa23ec273)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.7.0 ([#790](https://github.com/googleapis/java-language/issues/790)) ([56a7351](https://github.com/googleapis/java-language/commit/56a735107b28b3f5579585e4957312b167961ee3)) - -### [2.1.5](https://www.github.com/googleapis/java-language/compare/v2.1.4...v2.1.5) (2022-01-07) - - -### Bug Fixes - -* **java:** add -ntp flag to native image testing command ([#1299](https://www.github.com/googleapis/java-language/issues/1299)) ([#764](https://www.github.com/googleapis/java-language/issues/764)) ([43a006a](https://www.github.com/googleapis/java-language/commit/43a006a2a77c25a16e9d4034bc155bb5773257fb)) -* **java:** run Maven in plain console-friendly mode ([#1301](https://www.github.com/googleapis/java-language/issues/1301)) ([#770](https://www.github.com/googleapis/java-language/issues/770)) ([e4cd369](https://www.github.com/googleapis/java-language/commit/e4cd369220848f7d0bfd9c1be96c975237b54869)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.6.0 ([#774](https://www.github.com/googleapis/java-language/issues/774)) ([f77f6f7](https://www.github.com/googleapis/java-language/commit/f77f6f79cd88b038b5cfed34f2f243bd37bbe5fb)) - -### [2.1.4](https://www.github.com/googleapis/java-language/compare/v2.1.3...v2.1.4) (2021-12-03) - - -### Bug Fixes - -* **java:** java 17 dependency arguments ([#1266](https://www.github.com/googleapis/java-language/issues/1266)) ([#742](https://www.github.com/googleapis/java-language/issues/742)) ([48defbf](https://www.github.com/googleapis/java-language/commit/48defbf121efb9a8075cd64051bc7c93f21de8de)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.0 ([#752](https://www.github.com/googleapis/java-language/issues/752)) ([3b5753c](https://www.github.com/googleapis/java-language/commit/3b5753c76dad7ee1199a304bfd76e118b31ec2a8)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.1 ([#760](https://www.github.com/googleapis/java-language/issues/760)) ([14a9f32](https://www.github.com/googleapis/java-language/commit/14a9f326e88cdc599366aef1a53eee49ba55d1b9)) - -### [2.1.3](https://www.github.com/googleapis/java-language/compare/v2.1.2...v2.1.3) (2021-10-20) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.4.0 ([#737](https://www.github.com/googleapis/java-language/issues/737)) ([4184de2](https://www.github.com/googleapis/java-language/commit/4184de2d60612727c14bc0c586b8ea89f94394ed)) - -### [2.1.2](https://www.github.com/googleapis/java-language/compare/v2.1.1...v2.1.2) (2021-09-22) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.3.0 ([#723](https://www.github.com/googleapis/java-language/issues/723)) ([b245fe1](https://www.github.com/googleapis/java-language/commit/b245fe10f6ca80519354e0c0064c9b298cb6dd02)) - -### [2.1.1](https://www.github.com/googleapis/java-language/compare/v2.1.0...v2.1.1) (2021-09-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.1 ([#716](https://www.github.com/googleapis/java-language/issues/716)) ([6139969](https://www.github.com/googleapis/java-language/commit/6139969b61e53ac5bfcf026c58a011b90124a783)) - -## [2.1.0](https://www.github.com/googleapis/java-language/compare/v2.0.2...v2.1.0) (2021-09-01) - - -### Features - -* Remove use of deprecated gradle command in java README ([#1196](https://www.github.com/googleapis/java-language/issues/1196)) ([#699](https://www.github.com/googleapis/java-language/issues/699)) ([cfd2179](https://www.github.com/googleapis/java-language/commit/cfd2179e4e835f4a372ed73fd174a4b7e7edbb5e)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.0 ([#702](https://www.github.com/googleapis/java-language/issues/702)) ([ef02aeb](https://www.github.com/googleapis/java-language/commit/ef02aebfad0e6607d4d0d37ca4d129e4bd783916)) - -### [2.0.2](https://www.github.com/googleapis/java-language/compare/v2.0.1...v2.0.2) (2021-08-23) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.1.0 ([#691](https://www.github.com/googleapis/java-language/issues/691)) ([f4787e4](https://www.github.com/googleapis/java-language/commit/f4787e43dec654601637676bbc0968eb4cdf42f9)) - -### [2.0.1](https://www.github.com/googleapis/java-language/compare/v2.0.0...v2.0.1) (2021-08-12) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.0.1 ([#683](https://www.github.com/googleapis/java-language/issues/683)) ([9f4a254](https://www.github.com/googleapis/java-language/commit/9f4a254d64220e474da63978d6305f037db976db)) - -## [2.0.0](https://www.github.com/googleapis/java-language/compare/v1.103.2...v2.0.0) (2021-08-06) - - -### ⚠ BREAKING CHANGES - -* release gapic-generator-java v2.0.0 (#677) - -### Features - -* release gapic-generator-java v2.0.0 ([#677](https://www.github.com/googleapis/java-language/issues/677)) ([ec809de](https://www.github.com/googleapis/java-language/commit/ec809dedb6f7d1f51962377dad62f5a7e308853d)) - - -### Bug Fixes - -* owlbot post-processor should generate README ([#1154](https://www.github.com/googleapis/java-language/issues/1154)) ([#504](https://www.github.com/googleapis/java-language/issues/504)) ([e8e6d53](https://www.github.com/googleapis/java-language/commit/e8e6d5324196c75ac7e287798bca54e57184fbf4)), closes [#1146](https://www.github.com/googleapis/java-language/issues/1146) [#1147](https://www.github.com/googleapis/java-language/issues/1147) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2 ([#678](https://www.github.com/googleapis/java-language/issues/678)) ([62fe547](https://www.github.com/googleapis/java-language/commit/62fe547537c72cad19a2e79611d97c320ca32258)) - -### [1.103.2](https://www.github.com/googleapis/java-language/compare/v1.103.1...v1.103.2) (2021-07-01) - - -### Bug Fixes - -* Add `shopt -s nullglob` to dependencies script ([#1130](https://www.github.com/googleapis/java-language/issues/1130)) ([#490](https://www.github.com/googleapis/java-language/issues/490)) ([d6525dc](https://www.github.com/googleapis/java-language/commit/d6525dca8e2e5d6ea48580a4d6a9389560e4937f)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.4.0 ([#494](https://www.github.com/googleapis/java-language/issues/494)) ([73d0c8e](https://www.github.com/googleapis/java-language/commit/73d0c8ece375ce1ff09ced579652a8f13331f001)) - -### [1.103.1](https://www.github.com/googleapis/java-language/compare/v1.103.0...v1.103.1) (2021-06-04) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.3.0 ([#477](https://www.github.com/googleapis/java-language/issues/477)) ([463629d](https://www.github.com/googleapis/java-language/commit/463629db48b20fbc489f961408a159ce55d36d89)) - -## [1.103.0](https://www.github.com/googleapis/java-language/compare/v1.102.3...v1.103.0) (2021-05-26) - - -### Features - -* add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#464](https://www.github.com/googleapis/java-language/issues/464)) ([894ed25](https://www.github.com/googleapis/java-language/commit/894ed25f36aee0a6f43f80a1c668b12eac169937)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.2.0 ([#463](https://www.github.com/googleapis/java-language/issues/463)) ([5bbfa0b](https://www.github.com/googleapis/java-language/commit/5bbfa0b5fb6fe6b0a988e8d8a1827702cec548d2)) - -### [1.102.3](https://www.github.com/googleapis/java-language/compare/v1.102.2...v1.102.3) (2021-05-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.1.0 ([#453](https://www.github.com/googleapis/java-language/issues/453)) ([8a0ddf2](https://www.github.com/googleapis/java-language/commit/8a0ddf25027a6fd98a968bfc1348de3fdb8e3ab0)) - -### [1.102.2](https://www.github.com/googleapis/java-language/compare/v1.102.1...v1.102.2) (2021-04-23) - - -### Bug Fixes - -* release scripts from issuing overlapping phases ([#435](https://www.github.com/googleapis/java-language/issues/435)) ([bd56c26](https://www.github.com/googleapis/java-language/commit/bd56c26dfd0013a961a0d19b049c16760dd74247)) -* typo ([#432](https://www.github.com/googleapis/java-language/issues/432)) ([64d69c8](https://www.github.com/googleapis/java-language/commit/64d69c879dc6be2c56aff5c01ede91ca5680a466)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.1 ([#438](https://www.github.com/googleapis/java-language/issues/438)) ([f556fd2](https://www.github.com/googleapis/java-language/commit/f556fd29bc69008713fc5f5e5a6f0a9117d3eeb4)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1 ([#441](https://www.github.com/googleapis/java-language/issues/441)) ([5a769e1](https://www.github.com/googleapis/java-language/commit/5a769e1069d4b9444651257fce89a76c2b96aa57)) - -### [1.102.1](https://www.github.com/googleapis/java-language/compare/v1.102.0...v1.102.1) (2021-04-09) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.0 ([#421](https://www.github.com/googleapis/java-language/issues/421)) ([25bef3a](https://www.github.com/googleapis/java-language/commit/25bef3aeacab187acf36352c660b00bbdf001c39)) - -## [1.102.0](https://www.github.com/googleapis/java-language/compare/v1.101.12...v1.102.0) (2021-03-11) - - -### Features - -* **generator:** update protoc to v3.15.3 ([#394](https://www.github.com/googleapis/java-language/issues/394)) ([061720a](https://www.github.com/googleapis/java-language/commit/061720a0be1ebfce1bffcbdefcabeb86d3f98f3b)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.20.1 ([#405](https://www.github.com/googleapis/java-language/issues/405)) ([d68d427](https://www.github.com/googleapis/java-language/commit/d68d42752848657dd14b30efaa5efa81b8ad71a2)) - -### [1.101.12](https://www.github.com/googleapis/java-language/compare/v1.101.11...v1.101.12) (2021-02-25) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.20.0 ([#389](https://www.github.com/googleapis/java-language/issues/389)) ([0a1535e](https://www.github.com/googleapis/java-language/commit/0a1535e8f2b18514c3a51147dd3fcd6dda37eb1f)) - -### [1.101.11](https://www.github.com/googleapis/java-language/compare/v1.101.10...v1.101.11) (2021-02-22) - - -### Documentation - -* generate sample code in the Java microgenerator ([#368](https://www.github.com/googleapis/java-language/issues/368)) ([85e966a](https://www.github.com/googleapis/java-language/commit/85e966a9a65aedde5b93173993cd06c94cf629aa)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.19.0 ([#380](https://www.github.com/googleapis/java-language/issues/380)) ([55d4321](https://www.github.com/googleapis/java-language/commit/55d4321a5a10959eb3caf0f4fa9800ffb9fca2c9)) - -### [1.101.10](https://www.github.com/googleapis/java-language/compare/v1.101.9...v1.101.10) (2021-01-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.18.0 ([#349](https://www.github.com/googleapis/java-language/issues/349)) ([04c8c63](https://www.github.com/googleapis/java-language/commit/04c8c633850eca8e9d6b94e37d918c0953b7e380)) - -### [1.101.9](https://www.github.com/googleapis/java-language/compare/v1.101.8...v1.101.9) (2020-12-15) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.17.0 ([#334](https://www.github.com/googleapis/java-language/issues/334)) ([929d783](https://www.github.com/googleapis/java-language/commit/929d7832dc80f1a16e980b12e111b43e0516ff3d)) - -### [1.101.8](https://www.github.com/googleapis/java-language/compare/v1.101.7...v1.101.8) (2020-12-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#329](https://www.github.com/googleapis/java-language/issues/329)) ([96383fe](https://www.github.com/googleapis/java-language/commit/96383fe2f3adb4aef1f420eaec325c6e52c5f3cf)) - -### [1.101.7](https://www.github.com/googleapis/java-language/compare/v1.101.6...v1.101.7) (2020-12-02) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.0 ([#321](https://www.github.com/googleapis/java-language/issues/321)) ([52f43f5](https://www.github.com/googleapis/java-language/commit/52f43f502f81bacb1583f83e4cca828af6e17dc7)) - -### [1.101.6](https://www.github.com/googleapis/java-language/compare/v1.101.5...v1.101.6) (2020-11-11) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.15.0 ([#304](https://www.github.com/googleapis/java-language/issues/304)) ([493b37d](https://www.github.com/googleapis/java-language/commit/493b37d8c1c304e6e519cf98c3fa67ad4aa22e68)) - -### [1.101.5](https://www.github.com/googleapis/java-language/compare/v1.101.4...v1.101.5) (2020-11-04) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.14.1 ([#290](https://www.github.com/googleapis/java-language/issues/290)) ([f004c40](https://www.github.com/googleapis/java-language/commit/f004c40946e2e49f1d8eeb68799b3ffc436e0a9c)) - -### [1.101.4](https://www.github.com/googleapis/java-language/compare/v1.101.3...v1.101.4) (2020-10-22) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.12.1 ([#266](https://www.github.com/googleapis/java-language/issues/266)) ([2a7b20e](https://www.github.com/googleapis/java-language/commit/2a7b20e59e6510834db33964b534391c3183abf5)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.13.0 ([#271](https://www.github.com/googleapis/java-language/issues/271)) ([94a2d98](https://www.github.com/googleapis/java-language/commit/94a2d987ce82a5cc4552522c96011e52b52a13bf)) - -### [1.101.3](https://www.github.com/googleapis/java-language/compare/v1.101.2...v1.101.3) (2020-10-08) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.10.2 ([#248](https://www.github.com/googleapis/java-language/issues/248)) ([93408a1](https://www.github.com/googleapis/java-language/commit/93408a12db405460936f71bf71493d5df7386336)) - - -### Documentation - -* fix proto comments for language API inorder for docs parsing to work correctly ([#251](https://www.github.com/googleapis/java-language/issues/251)) ([de34d73](https://www.github.com/googleapis/java-language/commit/de34d7324d40cc90d3eea34300105d849f4922a4)) - -### [1.101.2](https://www.github.com/googleapis/java-language/compare/v1.101.1...v1.101.2) (2020-09-23) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.10.0 ([#233](https://www.github.com/googleapis/java-language/issues/233)) ([25b5327](https://www.github.com/googleapis/java-language/commit/25b5327f12791e554d1d723cd543e19e67b0b8e2)) - -### [1.101.1](https://www.github.com/googleapis/java-language/compare/v1.101.0...v1.101.1) (2020-09-22) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.9.0 ([#215](https://www.github.com/googleapis/java-language/issues/215)) ([687fdd6](https://www.github.com/googleapis/java-language/commit/687fdd6c90be3e8233c74fe40d9ae0b35f22495c)) - -## [1.101.0](https://www.github.com/googleapis/java-language/compare/v1.100.0...v1.101.0) (2020-08-07) - - -### Features - -* **deps:** adopt flatten plugin and google-cloud-shared-dependencies ([#176](https://www.github.com/googleapis/java-language/issues/176)) ([da9046c](https://www.github.com/googleapis/java-language/commit/da9046c2feaa90268761ba15e9b900ee183e2e3e)) - - -### Bug Fixes - -* migrate to grpc_service_config ([#188](https://www.github.com/googleapis/java-language/issues/188)) ([3d1762d](https://www.github.com/googleapis/java-language/commit/3d1762d33fc2d18d79c4f238b62fc44954fab39e)) - - -### Dependencies - -* update dependency com.google.api:api-common to v1.9.1 ([#150](https://www.github.com/googleapis/java-language/issues/150)) ([6d241fa](https://www.github.com/googleapis/java-language/commit/6d241fadb64cc5def074042ae80fc93042066463)) -* update dependency com.google.api:api-common to v1.9.2 ([#157](https://www.github.com/googleapis/java-language/issues/157)) ([83bf00b](https://www.github.com/googleapis/java-language/commit/83bf00b3217acff6ac7cc6d309a0c006c906d27a)) -* update dependency com.google.api.grpc:proto-google-common-protos to v1.18.0 ([#139](https://www.github.com/googleapis/java-language/issues/139)) ([d1b8516](https://www.github.com/googleapis/java-language/commit/d1b8516a1229ecc0807144b69dc9fe9e48b63c78)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.2 ([#189](https://www.github.com/googleapis/java-language/issues/189)) ([34c2867](https://www.github.com/googleapis/java-language/commit/34c2867a19c29f59f89e8205a8c6ebdcfbbf8285)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.3 ([#191](https://www.github.com/googleapis/java-language/issues/191)) ([ab13ac1](https://www.github.com/googleapis/java-language/commit/ab13ac15c46bed94902d176fc0a4d1264aea4e7e)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.6 ([#199](https://www.github.com/googleapis/java-language/issues/199)) ([9608a5b](https://www.github.com/googleapis/java-language/commit/9608a5be225fcebf138bb820c049c555aaea195d)) -* update dependency com.google.protobuf:protobuf-java to v3.12.0 ([#143](https://www.github.com/googleapis/java-language/issues/143)) ([9cc04fa](https://www.github.com/googleapis/java-language/commit/9cc04fa0e3be5864757f549f8c65b203c985ab34)) -* update dependency com.google.protobuf:protobuf-java to v3.12.2 ([#148](https://www.github.com/googleapis/java-language/issues/148)) ([69a8524](https://www.github.com/googleapis/java-language/commit/69a85247c7f521e94d2f9c3a75e8dc2fb7ae2f42)) -* update dependency io.grpc:grpc-bom to v1.29.0 ([#129](https://www.github.com/googleapis/java-language/issues/129)) ([d24999c](https://www.github.com/googleapis/java-language/commit/d24999c81bcfb95ceeeb6dc1a92afc577838ef23)) -* update dependency io.grpc:grpc-bom to v1.30.0 ([#161](https://www.github.com/googleapis/java-language/issues/161)) ([09240a3](https://www.github.com/googleapis/java-language/commit/09240a31bb6f5e1d6ae597521ebab080c68ac896)) -* update dependency org.threeten:threetenbp to v1.4.4 ([#135](https://www.github.com/googleapis/java-language/issues/135)) ([a4fdbc3](https://www.github.com/googleapis/java-language/commit/a4fdbc3265a02669fc1cd2494bb8fcbf5ca81bdd)) - -## [1.100.0](https://www.github.com/googleapis/java-language/compare/v1.99.4...v1.100.0) (2020-04-20) - - -### Features - -* add method overloads for Document+EncodingType for analyze methods ([#120](https://www.github.com/googleapis/java-language/issues/120)) ([60ef073](https://www.github.com/googleapis/java-language/commit/60ef07316809ba0deb03bf16b56f58e522874c09)) - - -### Dependencies - -* update dependency com.google.guava:guava-bom to v29 ([#107](https://www.github.com/googleapis/java-language/issues/107)) ([587f83b](https://www.github.com/googleapis/java-language/commit/587f83b52db60ced3854748a17def39524c1d346)) - -### [1.99.4](https://www.github.com/googleapis/java-language/compare/v1.99.3...v1.99.4) (2020-04-09) - - -### Documentation - -* change relative URLs to absolute URLs to fix broken links ([#100](https://www.github.com/googleapis/java-language/issues/100)) ([32e8447](https://www.github.com/googleapis/java-language/commit/32e8447e9d37a44f58204decf5dcdc0684786651)) - - -### Dependencies - -* update core dependencies ([#75](https://www.github.com/googleapis/java-language/issues/75)) ([480275f](https://www.github.com/googleapis/java-language/commit/480275fbaf5f97dc28ddaaa489d038cf7f0328cb)) -* update dependency com.google.api:api-common to v1.9.0 ([#94](https://www.github.com/googleapis/java-language/issues/94)) ([dc4a66f](https://www.github.com/googleapis/java-language/commit/dc4a66f0cc2b1af2760126269fdbb4c6ec776aa2)) -* update dependency org.threeten:threetenbp to v1.4.3 ([#84](https://www.github.com/googleapis/java-language/issues/84)) ([576eb7c](https://www.github.com/googleapis/java-language/commit/576eb7c7e43fe70ae129fa1a40eee22b59181c6b)) - -### [1.99.3](https://www.github.com/googleapis/java-language/compare/v1.99.2...v1.99.3) (2020-03-10) - - -### Dependencies - -* update core dependencies to v1.54.0 ([#68](https://www.github.com/googleapis/java-language/issues/68)) ([83bfbb0](https://www.github.com/googleapis/java-language/commit/83bfbb052520ffd0fa3c7f939ee069b062de993d)) -* update dependency com.google.protobuf:protobuf-java to v3.11.4 ([37b8732](https://www.github.com/googleapis/java-language/commit/37b87329ba932bb3134ebf4ad96c79eab2a88265)) -* update dependency io.grpc:grpc-bom to v1.27.1 ([4a30ea4](https://www.github.com/googleapis/java-language/commit/4a30ea4e3d93007f26a51b3986a5215d2f6855a5)) -* update dependency io.grpc:grpc-bom to v1.27.2 ([0a7eaa6](https://www.github.com/googleapis/java-language/commit/0a7eaa6019cfcf368dcc939d969ce622a01cd5cd)) -* update java-core ([#69](https://www.github.com/googleapis/java-language/issues/69)) ([ecc1822](https://www.github.com/googleapis/java-language/commit/ecc18229fd4229db26895740fc5f046fcd09605c)) - - -### Documentation - -* **regen:** update sample code to set total timeout, add API client header test ([4f9cc95](https://www.github.com/googleapis/java-language/commit/4f9cc95c1148920987d1f52bdc0207f08ec05a33)) - -### [1.99.2](https://www.github.com/googleapis/java-language/compare/v1.99.1...v1.99.2) (2020-02-04) - - -### Dependencies - -* update core dependencies to v1.53.0 ([#42](https://www.github.com/googleapis/java-language/issues/42)) ([1a19705](https://www.github.com/googleapis/java-language/commit/1a1970550f50d07af46be754fa717e050f450a70)) -* update core dependencies to v1.53.1 ([#52](https://www.github.com/googleapis/java-language/issues/52)) ([66ba508](https://www.github.com/googleapis/java-language/commit/66ba5080f716cdf8ae8cd3a1d35378d0a4cb0ac4)) -* update dependency com.google.guava:guava-bom to v28.2-android ([#32](https://www.github.com/googleapis/java-language/issues/32)) ([6430c77](https://www.github.com/googleapis/java-language/commit/6430c776ff9a1a7d463d0f35ebea529d00ec9101)) -* update dependency com.google.protobuf:protobuf-java to v3.11.3 ([#54](https://www.github.com/googleapis/java-language/issues/54)) ([1cd82ee](https://www.github.com/googleapis/java-language/commit/1cd82eee92cab3c7deda49591a303282dee737a7)) -* update dependency io.grpc:grpc-bom to v1.27.0 ([#50](https://www.github.com/googleapis/java-language/issues/50)) ([8519b4e](https://www.github.com/googleapis/java-language/commit/8519b4ef73b6335cdb06185f9a34e38ade7a670b)) -* update dependency org.threeten:threetenbp to v1.4.1 ([b042fcb](https://www.github.com/googleapis/java-language/commit/b042fcb563039c005babb677b189f2718153ad36)) - -### [1.99.1](https://www.github.com/googleapis/java-language/compare/v1.99.0...v1.99.1) (2020-01-07) - - -### Dependencies - -* update dependency com.google.protobuf:protobuf-java to v3.11.1 ([#24](https://www.github.com/googleapis/java-language/issues/24)) ([fd68b4e](https://www.github.com/googleapis/java-language/commit/fd68b4e101b8b530696a88cdd065a22207b639bb)) -* update dependency io.grpc:grpc-bom to v1.26.0 ([#25](https://www.github.com/googleapis/java-language/issues/25)) ([5c27457](https://www.github.com/googleapis/java-language/commit/5c27457fe0a7822ed64ee7f46d7a713ae8b98c22)) -* update gax.version to v1.52.0 ([#20](https://www.github.com/googleapis/java-language/issues/20)) ([aa6c548](https://www.github.com/googleapis/java-language/commit/aa6c5480610847515e56b311ea089924f5172d67)) - - -### Documentation - -* reference libraries-bom in docs ([#11](https://www.github.com/googleapis/java-language/issues/11)) ([a0ee87f](https://www.github.com/googleapis/java-language/commit/a0ee87f8fbb2e84fee0801a9de8598e5f19e860b)) -* **regen:** update generated javadoc ([#21](https://www.github.com/googleapis/java-language/issues/21)) ([da12b27](https://www.github.com/googleapis/java-language/commit/da12b27fa60eb3571c9eb62d7ee9361f984f23a8)) -* **regen:** update javadocs from protoc update ([#26](https://www.github.com/googleapis/java-language/issues/26)) ([08b3366](https://www.github.com/googleapis/java-language/commit/08b3366f073f0fdaf16d5d69dd0e54692bbb62f9)) - -## [1.99.0](https://www.github.com/googleapis/java-language/compare/1.98.0...v1.99.0) (2019-10-30) - - -### Features - -* make repo releasable, add parent/bom ([#1](https://www.github.com/googleapis/java-language/issues/1)) ([1c7cfa5](https://www.github.com/googleapis/java-language/commit/1c7cfa5a37d90b38128ea6114beb730c96f80655)) - - -### Dependencies - -* update dependency io.grpc:grpc-bom to v1.24.1 ([#3](https://www.github.com/googleapis/java-language/issues/3)) ([2ff2998](https://www.github.com/googleapis/java-language/commit/2ff2998a685f23ef8ec3c3d6d55b666ff0b52396)) -* update gax.version to v1.49.1 ([#5](https://www.github.com/googleapis/java-language/issues/5)) ([3adf4da](https://www.github.com/googleapis/java-language/commit/3adf4da661cdf0141bcb0276a7e2be2ac721ece9)) diff --git a/codecov.yaml b/codecov.yaml deleted file mode 100644 index 5724ea94..00000000 --- a/codecov.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -codecov: - ci: - - source.cloud.google.com diff --git a/google-cloud-language-bom/pom.xml b/google-cloud-language-bom/pom.xml deleted file mode 100644 index 44e6ce47..00000000 --- a/google-cloud-language-bom/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-language-bom - 2.4.2-SNAPSHOT - pom - - com.google.cloud - google-cloud-shared-config - 1.5.4 - - - Google Cloud language BOM - https://github.com/googleapis/java-language - - BOM for Google Cloud Natural Language - - - - Google LLC - - - - - chingor13 - Jeff Ching - chingor@google.com - Google LLC - - Developer - - - - - - scm:git:https://github.com/googleapis/java-language.git - scm:git:git@github.com:googleapis/java-language.git - https://github.com/googleapis/java-language - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - - com.google.cloud - google-cloud-language - 2.4.2-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-language-v1 - 2.4.2-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-language-v1beta2 - 0.91.2-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-language-v1 - 2.4.2-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - 0.91.2-SNAPSHOT - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - - - - - diff --git a/google-cloud-language/pom.xml b/google-cloud-language/pom.xml deleted file mode 100644 index da555089..00000000 --- a/google-cloud-language/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-language - 2.4.2-SNAPSHOT - jar - Google Cloud Natural Language - https://github.com/googleapis/java-language - Java idiomatic client for Google Clould Natural Language - - com.google.cloud - google-cloud-language-parent - 2.4.2-SNAPSHOT - - - google-cloud-language - - - - 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-language-v1 - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - - - com.google.guava - guava - - - com.google.api - gax - - - com.google.api - gax-grpc - - - com.google.api - gax-httpjson - - - org.threeten - threetenbp - - - - - junit - junit - test - - - - com.google.api.grpc - grpc-google-cloud-language-v1 - test - - - com.google.api.grpc - grpc-google-cloud-language-v1beta2 - test - - - - com.google.api - gax - testlib - test - - - com.google.api - gax-grpc - testlib - test - - - com.google.api - gax-httpjson - testlib - test - - - - - - java9 - - [9,) - - - - javax.annotation - javax.annotation-api - - - - - - - - - org.codehaus.mojo - flatten-maven-plugin - - - - diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java deleted file mode 100644 index dd726dd4..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java +++ /dev/null @@ -1,910 +0,0 @@ -/* - * Copyright 2022 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.language.v1; - -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.language.v1.stub.LanguageServiceStub; -import com.google.cloud.language.v1.stub.LanguageServiceStubSettings; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Service Description: Provides text analysis operations such as sentiment analysis and entity - * recognition. - * - *

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

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
- *   Document document = Document.newBuilder().build();
- *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
- * }
- * }
- * - *

Note: close() needs to be called on the LanguageServiceClient 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 LanguageServiceSettings to - * create(). For example: - * - *

To customize credentials: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over - * the wire: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newHttpJsonBuilder().build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@Generated("by gapic-generator-java") -public class LanguageServiceClient implements BackgroundResource { - private final LanguageServiceSettings settings; - private final LanguageServiceStub stub; - - /** Constructs an instance of LanguageServiceClient with default settings. */ - public static final LanguageServiceClient create() throws IOException { - return create(LanguageServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of LanguageServiceClient, 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 LanguageServiceClient create(LanguageServiceSettings settings) - throws IOException { - return new LanguageServiceClient(settings); - } - - /** - * Constructs an instance of LanguageServiceClient, using the given stub for making calls. This is - * for advanced usage - prefer using create(LanguageServiceSettings). - */ - public static final LanguageServiceClient create(LanguageServiceStub stub) { - return new LanguageServiceClient(stub); - } - - /** - * Constructs an instance of LanguageServiceClient, 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 LanguageServiceClient(LanguageServiceSettings settings) throws IOException { - this.settings = settings; - this.stub = ((LanguageServiceStubSettings) settings.getStubSettings()).createStub(); - } - - protected LanguageServiceClient(LanguageServiceStub stub) { - this.settings = null; - this.stub = stub; - } - - public final LanguageServiceSettings getSettings() { - return settings; - } - - public LanguageServiceStub getStub() { - return stub; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSentimentResponse analyzeSentiment(Document document) { - AnalyzeSentimentRequest request = - AnalyzeSentimentRequest.newBuilder().setDocument(document).build(); - return analyzeSentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeSentimentResponse response =
-   *       languageServiceClient.analyzeSentiment(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate sentence offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSentimentResponse analyzeSentiment( - Document document, EncodingType encodingType) { - AnalyzeSentimentRequest request = - AnalyzeSentimentRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeSentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSentimentResponse analyzeSentiment(AnalyzeSentimentRequest request) { - return analyzeSentimentCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeSentimentCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeSentimentResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - analyzeSentimentCallable() { - return stub.analyzeSentimentCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitiesResponse analyzeEntities(Document document) { - AnalyzeEntitiesRequest request = - AnalyzeEntitiesRequest.newBuilder().setDocument(document).build(); - return analyzeEntities(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeEntitiesResponse response =
-   *       languageServiceClient.analyzeEntities(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitiesResponse analyzeEntities( - Document document, EncodingType encodingType) { - AnalyzeEntitiesRequest request = - AnalyzeEntitiesRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeEntities(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitiesResponse analyzeEntities(AnalyzeEntitiesRequest request) { - return analyzeEntitiesCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeEntitiesCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeEntitiesResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - analyzeEntitiesCallable() { - return stub.analyzeEntitiesCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and - * analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitySentimentResponse analyzeEntitySentiment(Document document) { - AnalyzeEntitySentimentRequest request = - AnalyzeEntitySentimentRequest.newBuilder().setDocument(document).build(); - return analyzeEntitySentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and - * analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitySentimentResponse analyzeEntitySentiment( - Document document, EncodingType encodingType) { - AnalyzeEntitySentimentRequest request = - AnalyzeEntitySentimentRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeEntitySentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and - * analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitySentimentResponse analyzeEntitySentiment( - AnalyzeEntitySentimentRequest request) { - return analyzeEntitySentimentCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and - * analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeEntitySentimentCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeEntitySentimentResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - analyzeEntitySentimentCallable() { - return stub.analyzeEntitySentimentCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSyntaxResponse analyzeSyntax(Document document) { - AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder().setDocument(document).build(); - return analyzeSyntax(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSyntaxResponse analyzeSyntax(Document document, EncodingType encodingType) { - AnalyzeSyntaxRequest request = - AnalyzeSyntaxRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeSyntax(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSyntaxResponse analyzeSyntax(AnalyzeSyntaxRequest request) { - return analyzeSyntaxCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeSyntaxCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeSyntaxResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable analyzeSyntaxCallable() { - return stub.analyzeSyntaxCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Classifies a document into categories. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   ClassifyTextResponse response = languageServiceClient.classifyText(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ClassifyTextResponse classifyText(Document document) { - ClassifyTextRequest request = ClassifyTextRequest.newBuilder().setDocument(document).build(); - return classifyText(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Classifies a document into categories. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setClassificationModelOptions(ClassificationModelOptions.newBuilder().build())
-   *           .build();
-   *   ClassifyTextResponse response = languageServiceClient.classifyText(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ClassifyTextResponse classifyText(ClassifyTextRequest request) { - return classifyTextCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Classifies a document into categories. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setClassificationModelOptions(ClassificationModelOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.classifyTextCallable().futureCall(request);
-   *   // Do something.
-   *   ClassifyTextResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable classifyTextCallable() { - return stub.classifyTextCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and - * analyzeSyntax provide in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   AnnotateTextResponse response = languageServiceClient.annotateText(document, features);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param features Required. The enabled features. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnnotateTextResponse annotateText( - Document document, AnnotateTextRequest.Features features) { - AnnotateTextRequest request = - AnnotateTextRequest.newBuilder().setDocument(document).setFeatures(features).build(); - return annotateText(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and - * analyzeSyntax provide in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnnotateTextResponse response =
-   *       languageServiceClient.annotateText(document, features, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param features Required. The enabled features. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnnotateTextResponse annotateText( - Document document, AnnotateTextRequest.Features features, EncodingType encodingType) { - AnnotateTextRequest request = - AnnotateTextRequest.newBuilder() - .setDocument(document) - .setFeatures(features) - .setEncodingType(encodingType) - .build(); - return annotateText(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and - * analyzeSyntax provide in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnnotateTextResponse response = languageServiceClient.annotateText(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnnotateTextResponse annotateText(AnnotateTextRequest request) { - return annotateTextCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and - * analyzeSyntax provide in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.annotateTextCallable().futureCall(request);
-   *   // Do something.
-   *   AnnotateTextResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable annotateTextCallable() { - return stub.annotateTextCallable(); - } - - @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-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java deleted file mode 100644 index ddb085e7..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright 2022 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.language.v1; - -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.httpjson.InstantiatingHttpJsonChannelProvider; -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.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.language.v1.stub.LanguageServiceStubSettings; -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 LanguageServiceClient}. - * - *

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

    - *
  • The default service address (language.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 analyzeSentiment to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceSettings.newBuilder();
- * languageServiceSettingsBuilder
- *     .analyzeSentimentSettings()
- *     .setRetrySettings(
- *         languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LanguageServiceSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * }
- */ -@Generated("by gapic-generator-java") -public class LanguageServiceSettings extends ClientSettings { - - /** Returns the object with the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings - analyzeSentimentSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeSentimentSettings(); - } - - /** Returns the object with the settings used for calls to analyzeEntities. */ - public UnaryCallSettings - analyzeEntitiesSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeEntitiesSettings(); - } - - /** Returns the object with the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings - analyzeEntitySentimentSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeEntitySentimentSettings(); - } - - /** Returns the object with the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings analyzeSyntaxSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeSyntaxSettings(); - } - - /** Returns the object with the settings used for calls to classifyText. */ - public UnaryCallSettings classifyTextSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).classifyTextSettings(); - } - - /** Returns the object with the settings used for calls to annotateText. */ - public UnaryCallSettings annotateTextSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).annotateTextSettings(); - } - - public static final LanguageServiceSettings create(LanguageServiceStubSettings stub) - throws IOException { - return new LanguageServiceSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return LanguageServiceStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return LanguageServiceStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return LanguageServiceStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return LanguageServiceStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return LanguageServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return LanguageServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return LanguageServiceStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return LanguageServiceStubSettings.defaultApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - @BetaApi - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** 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 LanguageServiceSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for LanguageServiceSettings. */ - public static class Builder extends ClientSettings.Builder { - - protected Builder() throws IOException { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(LanguageServiceStubSettings.newBuilder(clientContext)); - } - - protected Builder(LanguageServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(LanguageServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - private static Builder createDefault() { - return new Builder(LanguageServiceStubSettings.newBuilder()); - } - - @BetaApi - private static Builder createHttpJsonDefault() { - return new Builder(LanguageServiceStubSettings.newHttpJsonBuilder()); - } - - public LanguageServiceStubSettings.Builder getStubSettingsBuilder() { - return ((LanguageServiceStubSettings.Builder) getStubSettings()); - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings.Builder - analyzeSentimentSettings() { - return getStubSettingsBuilder().analyzeSentimentSettings(); - } - - /** Returns the builder for the settings used for calls to analyzeEntities. */ - public UnaryCallSettings.Builder - analyzeEntitiesSettings() { - return getStubSettingsBuilder().analyzeEntitiesSettings(); - } - - /** Returns the builder for the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings.Builder - analyzeEntitySentimentSettings() { - return getStubSettingsBuilder().analyzeEntitySentimentSettings(); - } - - /** Returns the builder for the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings.Builder - analyzeSyntaxSettings() { - return getStubSettingsBuilder().analyzeSyntaxSettings(); - } - - /** Returns the builder for the settings used for calls to classifyText. */ - public UnaryCallSettings.Builder - classifyTextSettings() { - return getStubSettingsBuilder().classifyTextSettings(); - } - - /** Returns the builder for the settings used for calls to annotateText. */ - public UnaryCallSettings.Builder - annotateTextSettings() { - return getStubSettingsBuilder().annotateTextSettings(); - } - - @Override - public LanguageServiceSettings build() throws IOException { - return new LanguageServiceSettings(this); - } - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/gapic_metadata.json b/google-cloud-language/src/main/java/com/google/cloud/language/v1/gapic_metadata.json deleted file mode 100644 index 46503565..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/gapic_metadata.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "java", - "protoPackage": "google.cloud.language.v1", - "libraryPackage": "com.google.cloud.language.v1", - "services": { - "LanguageService": { - "clients": { - "grpc": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeEntities": { - "methods": ["analyzeEntities", "analyzeEntities", "analyzeEntities", "analyzeEntitiesCallable"] - }, - "AnalyzeEntitySentiment": { - "methods": ["analyzeEntitySentiment", "analyzeEntitySentiment", "analyzeEntitySentiment", "analyzeEntitySentimentCallable"] - }, - "AnalyzeSentiment": { - "methods": ["analyzeSentiment", "analyzeSentiment", "analyzeSentiment", "analyzeSentimentCallable"] - }, - "AnalyzeSyntax": { - "methods": ["analyzeSyntax", "analyzeSyntax", "analyzeSyntax", "analyzeSyntaxCallable"] - }, - "AnnotateText": { - "methods": ["annotateText", "annotateText", "annotateText", "annotateTextCallable"] - }, - "ClassifyText": { - "methods": ["classifyText", "classifyText", "classifyTextCallable"] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java deleted file mode 100644 index a3260a78..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 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 Natural Language API - * - *

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

======================= LanguageServiceClient ======================= - * - *

Service Description: Provides text analysis operations such as sentiment analysis and entity - * recognition. - * - *

Sample for LanguageServiceClient: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
- *   Document document = Document.newBuilder().build();
- *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
- * }
- * }
- */ -@Generated("by gapic-generator-java") -package com.google.cloud.language.v1; - -import javax.annotation.Generated; diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java deleted file mode 100644 index 8fcd7a3b..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2022 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.language.v1.stub; - -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcCallableFactory; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC callable factory implementation for the LanguageService service API. - * - *

This class is for advanced usage. - */ -@Generated("by gapic-generator-java") -public class GrpcLanguageServiceCallableFactory implements GrpcStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - GrpcCallSettings grpcCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - GrpcCallSettings grpcCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, callSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java deleted file mode 100644 index 7283548c..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright 2022 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.language.v1.stub; - -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.UnaryCallable; -import com.google.cloud.language.v1.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1.AnalyzeSentimentRequest; -import com.google.cloud.language.v1.AnalyzeSentimentResponse; -import com.google.cloud.language.v1.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1.AnnotateTextRequest; -import com.google.cloud.language.v1.AnnotateTextResponse; -import com.google.cloud.language.v1.ClassifyTextRequest; -import com.google.cloud.language.v1.ClassifyTextResponse; -import com.google.longrunning.stub.GrpcOperationsStub; -import io.grpc.MethodDescriptor; -import io.grpc.protobuf.ProtoUtils; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC stub implementation for the LanguageService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator-java") -public class GrpcLanguageServiceStub extends LanguageServiceStub { - private static final MethodDescriptor - analyzeSentimentMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSentiment") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeSentimentRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeSentimentResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - analyzeEntitiesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntities") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeEntitiesRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeEntitiesResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor< - AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> - analyzeEntitySentimentMethodDescriptor = - MethodDescriptor - .newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeEntitySentimentRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeEntitySentimentResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - analyzeSyntaxMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSyntax") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeSyntaxRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeSyntaxResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - classifyTextMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1.LanguageService/ClassifyText") - .setRequestMarshaller(ProtoUtils.marshaller(ClassifyTextRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ClassifyTextResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - annotateTextMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1.LanguageService/AnnotateText") - .setRequestMarshaller(ProtoUtils.marshaller(AnnotateTextRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnnotateTextResponse.getDefaultInstance())) - .build(); - - private final UnaryCallable - analyzeSentimentCallable; - private final UnaryCallable - analyzeEntitiesCallable; - private final UnaryCallable - analyzeEntitySentimentCallable; - private final UnaryCallable analyzeSyntaxCallable; - private final UnaryCallable classifyTextCallable; - private final UnaryCallable annotateTextCallable; - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final GrpcStubCallableFactory callableFactory; - - public static final GrpcLanguageServiceStub create(LanguageServiceStubSettings settings) - throws IOException { - return new GrpcLanguageServiceStub(settings, ClientContext.create(settings)); - } - - public static final GrpcLanguageServiceStub create(ClientContext clientContext) - throws IOException { - return new GrpcLanguageServiceStub( - LanguageServiceStubSettings.newBuilder().build(), clientContext); - } - - public static final GrpcLanguageServiceStub create( - ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { - return new GrpcLanguageServiceStub( - LanguageServiceStubSettings.newBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of GrpcLanguageServiceStub, 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 GrpcLanguageServiceStub( - LanguageServiceStubSettings settings, ClientContext clientContext) throws IOException { - this(settings, clientContext, new GrpcLanguageServiceCallableFactory()); - } - - /** - * Constructs an instance of GrpcLanguageServiceStub, 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 GrpcLanguageServiceStub( - LanguageServiceStubSettings settings, - ClientContext clientContext, - GrpcStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - - GrpcCallSettings - analyzeSentimentTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(analyzeSentimentMethodDescriptor) - .build(); - GrpcCallSettings - analyzeEntitiesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(analyzeEntitiesMethodDescriptor) - .build(); - GrpcCallSettings - analyzeEntitySentimentTransportSettings = - GrpcCallSettings - .newBuilder() - .setMethodDescriptor(analyzeEntitySentimentMethodDescriptor) - .build(); - GrpcCallSettings analyzeSyntaxTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(analyzeSyntaxMethodDescriptor) - .build(); - GrpcCallSettings classifyTextTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(classifyTextMethodDescriptor) - .build(); - GrpcCallSettings annotateTextTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(annotateTextMethodDescriptor) - .build(); - - this.analyzeSentimentCallable = - callableFactory.createUnaryCallable( - analyzeSentimentTransportSettings, settings.analyzeSentimentSettings(), clientContext); - this.analyzeEntitiesCallable = - callableFactory.createUnaryCallable( - analyzeEntitiesTransportSettings, settings.analyzeEntitiesSettings(), clientContext); - this.analyzeEntitySentimentCallable = - callableFactory.createUnaryCallable( - analyzeEntitySentimentTransportSettings, - settings.analyzeEntitySentimentSettings(), - clientContext); - this.analyzeSyntaxCallable = - callableFactory.createUnaryCallable( - analyzeSyntaxTransportSettings, settings.analyzeSyntaxSettings(), clientContext); - this.classifyTextCallable = - callableFactory.createUnaryCallable( - classifyTextTransportSettings, settings.classifyTextSettings(), clientContext); - this.annotateTextCallable = - callableFactory.createUnaryCallable( - annotateTextTransportSettings, settings.annotateTextSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - @Override - public UnaryCallable - analyzeSentimentCallable() { - return analyzeSentimentCallable; - } - - @Override - public UnaryCallable analyzeEntitiesCallable() { - return analyzeEntitiesCallable; - } - - @Override - public UnaryCallable - analyzeEntitySentimentCallable() { - return analyzeEntitySentimentCallable; - } - - @Override - public UnaryCallable analyzeSyntaxCallable() { - return analyzeSyntaxCallable; - } - - @Override - public UnaryCallable classifyTextCallable() { - return classifyTextCallable; - } - - @Override - public UnaryCallable annotateTextCallable() { - return annotateTextCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceCallableFactory.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceCallableFactory.java deleted file mode 100644 index e6957779..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceCallableFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2022 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.language.v1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonCallableFactory; -import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.ClientContext; -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.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST callable factory implementation for the LanguageService service API. - * - *

This class is for advanced usage. - */ -@Generated("by gapic-generator-java") -@BetaApi -public class HttpJsonLanguageServiceCallableFactory - implements HttpJsonStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - HttpJsonCallSettings httpJsonCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createUnaryCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - HttpJsonCallSettings httpJsonCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createPagedCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - HttpJsonCallSettings httpJsonCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createBatchingCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - @Override - public - OperationCallable createOperationCallable( - HttpJsonCallSettings httpJsonCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - UnaryCallable innerCallable = - HttpJsonCallableFactory.createBaseUnaryCallable( - httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); - HttpJsonOperationSnapshotCallable initialCallable = - new HttpJsonOperationSnapshotCallable( - innerCallable, - httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); - return HttpJsonCallableFactory.createOperationCallable( - callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - HttpJsonCallSettings httpJsonCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createServerStreamingCallable( - httpJsonCallSettings, callSettings, clientContext); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceStub.java deleted file mode 100644 index 7956fe99..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceStub.java +++ /dev/null @@ -1,467 +0,0 @@ -/* - * Copyright 2022 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.language.v1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.core.InternalApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.httpjson.ApiMethodDescriptor; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; -import com.google.api.gax.httpjson.ProtoMessageResponseParser; -import com.google.api.gax.httpjson.ProtoRestSerializer; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.language.v1.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1.AnalyzeSentimentRequest; -import com.google.cloud.language.v1.AnalyzeSentimentResponse; -import com.google.cloud.language.v1.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1.AnnotateTextRequest; -import com.google.cloud.language.v1.AnnotateTextResponse; -import com.google.cloud.language.v1.ClassifyTextRequest; -import com.google.cloud.language.v1.ClassifyTextResponse; -import com.google.protobuf.TypeRegistry; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST stub implementation for the LanguageService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator-java") -@BetaApi -public class HttpJsonLanguageServiceStub extends LanguageServiceStub { - private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); - - private static final ApiMethodDescriptor - analyzeSentimentMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSentiment") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/documents:analyzeSentiment", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeSentimentResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - analyzeEntitiesMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntities") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/documents:analyzeEntities", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeEntitiesResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor< - AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> - analyzeEntitySentimentMethodDescriptor = - ApiMethodDescriptor - .newBuilder() - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/documents:analyzeEntitySentiment", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeEntitySentimentResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - analyzeSyntaxMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSyntax") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/documents:analyzeSyntax", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeSyntaxResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - classifyTextMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1.LanguageService/ClassifyText") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/documents:classifyText", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ClassifyTextResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - annotateTextMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1.LanguageService/AnnotateText") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/documents:annotateText", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnnotateTextResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private final UnaryCallable - analyzeSentimentCallable; - private final UnaryCallable - analyzeEntitiesCallable; - private final UnaryCallable - analyzeEntitySentimentCallable; - private final UnaryCallable analyzeSyntaxCallable; - private final UnaryCallable classifyTextCallable; - private final UnaryCallable annotateTextCallable; - - private final BackgroundResource backgroundResources; - private final HttpJsonStubCallableFactory callableFactory; - - public static final HttpJsonLanguageServiceStub create(LanguageServiceStubSettings settings) - throws IOException { - return new HttpJsonLanguageServiceStub(settings, ClientContext.create(settings)); - } - - public static final HttpJsonLanguageServiceStub create(ClientContext clientContext) - throws IOException { - return new HttpJsonLanguageServiceStub( - LanguageServiceStubSettings.newHttpJsonBuilder().build(), clientContext); - } - - public static final HttpJsonLanguageServiceStub create( - ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { - return new HttpJsonLanguageServiceStub( - LanguageServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of HttpJsonLanguageServiceStub, 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 HttpJsonLanguageServiceStub( - LanguageServiceStubSettings settings, ClientContext clientContext) throws IOException { - this(settings, clientContext, new HttpJsonLanguageServiceCallableFactory()); - } - - /** - * Constructs an instance of HttpJsonLanguageServiceStub, 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 HttpJsonLanguageServiceStub( - LanguageServiceStubSettings settings, - ClientContext clientContext, - HttpJsonStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - - HttpJsonCallSettings - analyzeSentimentTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(analyzeSentimentMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - analyzeEntitiesTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(analyzeEntitiesMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - analyzeEntitySentimentTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(analyzeEntitySentimentMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - analyzeSyntaxTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(analyzeSyntaxMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings classifyTextTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(classifyTextMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings annotateTextTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(annotateTextMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - - this.analyzeSentimentCallable = - callableFactory.createUnaryCallable( - analyzeSentimentTransportSettings, settings.analyzeSentimentSettings(), clientContext); - this.analyzeEntitiesCallable = - callableFactory.createUnaryCallable( - analyzeEntitiesTransportSettings, settings.analyzeEntitiesSettings(), clientContext); - this.analyzeEntitySentimentCallable = - callableFactory.createUnaryCallable( - analyzeEntitySentimentTransportSettings, - settings.analyzeEntitySentimentSettings(), - clientContext); - this.analyzeSyntaxCallable = - callableFactory.createUnaryCallable( - analyzeSyntaxTransportSettings, settings.analyzeSyntaxSettings(), clientContext); - this.classifyTextCallable = - callableFactory.createUnaryCallable( - classifyTextTransportSettings, settings.classifyTextSettings(), clientContext); - this.annotateTextCallable = - callableFactory.createUnaryCallable( - annotateTextTransportSettings, settings.annotateTextSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - @InternalApi - public static List getMethodDescriptors() { - List methodDescriptors = new ArrayList<>(); - methodDescriptors.add(analyzeSentimentMethodDescriptor); - methodDescriptors.add(analyzeEntitiesMethodDescriptor); - methodDescriptors.add(analyzeEntitySentimentMethodDescriptor); - methodDescriptors.add(analyzeSyntaxMethodDescriptor); - methodDescriptors.add(classifyTextMethodDescriptor); - methodDescriptors.add(annotateTextMethodDescriptor); - return methodDescriptors; - } - - @Override - public UnaryCallable - analyzeSentimentCallable() { - return analyzeSentimentCallable; - } - - @Override - public UnaryCallable analyzeEntitiesCallable() { - return analyzeEntitiesCallable; - } - - @Override - public UnaryCallable - analyzeEntitySentimentCallable() { - return analyzeEntitySentimentCallable; - } - - @Override - public UnaryCallable analyzeSyntaxCallable() { - return analyzeSyntaxCallable; - } - - @Override - public UnaryCallable classifyTextCallable() { - return classifyTextCallable; - } - - @Override - public UnaryCallable annotateTextCallable() { - return annotateTextCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java deleted file mode 100644 index 89ea0036..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2022 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.language.v1.stub; - -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.language.v1.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1.AnalyzeSentimentRequest; -import com.google.cloud.language.v1.AnalyzeSentimentResponse; -import com.google.cloud.language.v1.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1.AnnotateTextRequest; -import com.google.cloud.language.v1.AnnotateTextResponse; -import com.google.cloud.language.v1.ClassifyTextRequest; -import com.google.cloud.language.v1.ClassifyTextResponse; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Base stub class for the LanguageService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator-java") -public abstract class LanguageServiceStub implements BackgroundResource { - - public UnaryCallable - analyzeSentimentCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeSentimentCallable()"); - } - - public UnaryCallable analyzeEntitiesCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeEntitiesCallable()"); - } - - public UnaryCallable - analyzeEntitySentimentCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeEntitySentimentCallable()"); - } - - public UnaryCallable analyzeSyntaxCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeSyntaxCallable()"); - } - - public UnaryCallable classifyTextCallable() { - throw new UnsupportedOperationException("Not implemented: classifyTextCallable()"); - } - - public UnaryCallable annotateTextCallable() { - throw new UnsupportedOperationException("Not implemented: annotateTextCallable()"); - } - - @Override - public abstract void close(); -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java deleted file mode 100644 index 2b662592..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Copyright 2022 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.language.v1.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.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.HttpJsonTransportChannel; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -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.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.language.v1.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1.AnalyzeSentimentRequest; -import com.google.cloud.language.v1.AnalyzeSentimentResponse; -import com.google.cloud.language.v1.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1.AnnotateTextRequest; -import com.google.cloud.language.v1.AnnotateTextResponse; -import com.google.cloud.language.v1.ClassifyTextRequest; -import com.google.cloud.language.v1.ClassifyTextResponse; -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 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 LanguageServiceStub}. - * - *

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

    - *
  • The default service address (language.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 analyzeSentiment to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceStubSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceStubSettings.newBuilder();
- * languageServiceSettingsBuilder
- *     .analyzeSentimentSettings()
- *     .setRetrySettings(
- *         languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LanguageServiceStubSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * }
- */ -@Generated("by gapic-generator-java") -public class LanguageServiceStubSettings extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder() - .add("https://www.googleapis.com/auth/cloud-language") - .add("https://www.googleapis.com/auth/cloud-platform") - .build(); - - private final UnaryCallSettings - analyzeSentimentSettings; - private final UnaryCallSettings - analyzeEntitiesSettings; - private final UnaryCallSettings - analyzeEntitySentimentSettings; - private final UnaryCallSettings - analyzeSyntaxSettings; - private final UnaryCallSettings classifyTextSettings; - private final UnaryCallSettings annotateTextSettings; - - /** Returns the object with the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings - analyzeSentimentSettings() { - return analyzeSentimentSettings; - } - - /** Returns the object with the settings used for calls to analyzeEntities. */ - public UnaryCallSettings - analyzeEntitiesSettings() { - return analyzeEntitiesSettings; - } - - /** Returns the object with the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings - analyzeEntitySentimentSettings() { - return analyzeEntitySentimentSettings; - } - - /** Returns the object with the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings analyzeSyntaxSettings() { - return analyzeSyntaxSettings; - } - - /** Returns the object with the settings used for calls to classifyText. */ - public UnaryCallSettings classifyTextSettings() { - return classifyTextSettings; - } - - /** Returns the object with the settings used for calls to annotateText. */ - public UnaryCallSettings annotateTextSettings() { - return annotateTextSettings; - } - - public LanguageServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcLanguageServiceStub.create(this); - } - if (getTransportChannelProvider() - .getTransportName() - .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { - return HttpJsonLanguageServiceStub.create(this); - } - throw new UnsupportedOperationException( - String.format( - "Transport not supported: %s", 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 "language.googleapis.com:443"; - } - - /** Returns the default mTLS service endpoint. */ - public static String getDefaultMtlsEndpoint() { - return "language.mtls.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder() - .setScopesToApply(DEFAULT_SERVICE_SCOPES) - .setUseJwtAccessWithScope(true); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return InstantiatingHttpJsonChannelProvider.newBuilder(); - } - - 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 defaultGrpcApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(LanguageServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(LanguageServiceStubSettings.class)) - .setTransportToken( - GaxHttpJsonProperties.getHttpJsonTokenName(), - GaxHttpJsonProperties.getHttpJsonVersion()); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return LanguageServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** 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 LanguageServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - analyzeSentimentSettings = settingsBuilder.analyzeSentimentSettings().build(); - analyzeEntitiesSettings = settingsBuilder.analyzeEntitiesSettings().build(); - analyzeEntitySentimentSettings = settingsBuilder.analyzeEntitySentimentSettings().build(); - analyzeSyntaxSettings = settingsBuilder.analyzeSyntaxSettings().build(); - classifyTextSettings = settingsBuilder.classifyTextSettings().build(); - annotateTextSettings = settingsBuilder.annotateTextSettings().build(); - } - - /** Builder for LanguageServiceStubSettings. */ - public static class Builder extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder - analyzeSentimentSettings; - private final UnaryCallSettings.Builder - analyzeEntitiesSettings; - private final UnaryCallSettings.Builder< - AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> - analyzeEntitySentimentSettings; - private final UnaryCallSettings.Builder - analyzeSyntaxSettings; - private final UnaryCallSettings.Builder - classifyTextSettings; - private final UnaryCallSettings.Builder - annotateTextSettings; - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "retry_policy_0_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(600000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(600000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) - .build(); - definitions.put("retry_policy_0_params", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - analyzeSentimentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - analyzeEntitiesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - analyzeEntitySentimentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - analyzeSyntaxSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - classifyTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - annotateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - analyzeSentimentSettings, - analyzeEntitiesSettings, - analyzeEntitySentimentSettings, - analyzeSyntaxSettings, - classifyTextSettings, - annotateTextSettings); - initDefaults(this); - } - - protected Builder(LanguageServiceStubSettings settings) { - super(settings); - - analyzeSentimentSettings = settings.analyzeSentimentSettings.toBuilder(); - analyzeEntitiesSettings = settings.analyzeEntitiesSettings.toBuilder(); - analyzeEntitySentimentSettings = settings.analyzeEntitySentimentSettings.toBuilder(); - analyzeSyntaxSettings = settings.analyzeSyntaxSettings.toBuilder(); - classifyTextSettings = settings.classifyTextSettings.toBuilder(); - annotateTextSettings = settings.annotateTextSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - analyzeSentimentSettings, - analyzeEntitiesSettings, - analyzeEntitySentimentSettings, - analyzeSyntaxSettings, - classifyTextSettings, - annotateTextSettings); - } - - private static Builder createDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder createHttpJsonDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - builder - .analyzeSentimentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .analyzeEntitiesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .analyzeEntitySentimentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .analyzeSyntaxSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .classifyTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .annotateTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - return builder; - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings.Builder - analyzeSentimentSettings() { - return analyzeSentimentSettings; - } - - /** Returns the builder for the settings used for calls to analyzeEntities. */ - public UnaryCallSettings.Builder - analyzeEntitiesSettings() { - return analyzeEntitiesSettings; - } - - /** Returns the builder for the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings.Builder - analyzeEntitySentimentSettings() { - return analyzeEntitySentimentSettings; - } - - /** Returns the builder for the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings.Builder - analyzeSyntaxSettings() { - return analyzeSyntaxSettings; - } - - /** Returns the builder for the settings used for calls to classifyText. */ - public UnaryCallSettings.Builder - classifyTextSettings() { - return classifyTextSettings; - } - - /** Returns the builder for the settings used for calls to annotateText. */ - public UnaryCallSettings.Builder - annotateTextSettings() { - return annotateTextSettings; - } - - @Override - public LanguageServiceStubSettings build() throws IOException { - return new LanguageServiceStubSettings(this); - } - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java deleted file mode 100644 index ca3318fc..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java +++ /dev/null @@ -1,913 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.language.v1beta2.stub.LanguageServiceStub; -import com.google.cloud.language.v1beta2.stub.LanguageServiceStubSettings; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Service Description: Provides text analysis operations such as sentiment analysis and entity - * recognition. - * - *

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

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
- *   Document document = Document.newBuilder().build();
- *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
- * }
- * }
- * - *

Note: close() needs to be called on the LanguageServiceClient 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 LanguageServiceSettings to - * create(). For example: - * - *

To customize credentials: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over - * the wire: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newHttpJsonBuilder().build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class LanguageServiceClient implements BackgroundResource { - private final LanguageServiceSettings settings; - private final LanguageServiceStub stub; - - /** Constructs an instance of LanguageServiceClient with default settings. */ - public static final LanguageServiceClient create() throws IOException { - return create(LanguageServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of LanguageServiceClient, 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 LanguageServiceClient create(LanguageServiceSettings settings) - throws IOException { - return new LanguageServiceClient(settings); - } - - /** - * Constructs an instance of LanguageServiceClient, using the given stub for making calls. This is - * for advanced usage - prefer using create(LanguageServiceSettings). - */ - public static final LanguageServiceClient create(LanguageServiceStub stub) { - return new LanguageServiceClient(stub); - } - - /** - * Constructs an instance of LanguageServiceClient, 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 LanguageServiceClient(LanguageServiceSettings settings) throws IOException { - this.settings = settings; - this.stub = ((LanguageServiceStubSettings) settings.getStubSettings()).createStub(); - } - - protected LanguageServiceClient(LanguageServiceStub stub) { - this.settings = null; - this.stub = stub; - } - - public final LanguageServiceSettings getSettings() { - return settings; - } - - public LanguageServiceStub getStub() { - return stub; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSentimentResponse analyzeSentiment(Document document) { - AnalyzeSentimentRequest request = - AnalyzeSentimentRequest.newBuilder().setDocument(document).build(); - return analyzeSentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeSentimentResponse response =
-   *       languageServiceClient.analyzeSentiment(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate sentence offsets for the - * sentence sentiment. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSentimentResponse analyzeSentiment( - Document document, EncodingType encodingType) { - AnalyzeSentimentRequest request = - AnalyzeSentimentRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeSentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSentimentResponse analyzeSentiment(AnalyzeSentimentRequest request) { - return analyzeSentimentCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeSentimentCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeSentimentResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - analyzeSentimentCallable() { - return stub.analyzeSentimentCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitiesResponse analyzeEntities(Document document) { - AnalyzeEntitiesRequest request = - AnalyzeEntitiesRequest.newBuilder().setDocument(document).build(); - return analyzeEntities(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeEntitiesResponse response =
-   *       languageServiceClient.analyzeEntities(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitiesResponse analyzeEntities( - Document document, EncodingType encodingType) { - AnalyzeEntitiesRequest request = - AnalyzeEntitiesRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeEntities(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitiesResponse analyzeEntities(AnalyzeEntitiesRequest request) { - return analyzeEntitiesCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds named entities (currently proper names and common nouns) in the text along with entity - * types, salience, mentions for each entity, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeEntitiesCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeEntitiesResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - analyzeEntitiesCallable() { - return stub.analyzeEntitiesCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text - * and analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitySentimentResponse analyzeEntitySentiment(Document document) { - AnalyzeEntitySentimentRequest request = - AnalyzeEntitySentimentRequest.newBuilder().setDocument(document).build(); - return analyzeEntitySentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text - * and analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitySentimentResponse analyzeEntitySentiment( - Document document, EncodingType encodingType) { - AnalyzeEntitySentimentRequest request = - AnalyzeEntitySentimentRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeEntitySentiment(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text - * and analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeEntitySentimentResponse analyzeEntitySentiment( - AnalyzeEntitySentimentRequest request) { - return analyzeEntitySentimentCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Finds entities, similar to - * [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text - * and analyzes sentiment associated with each entity and its mentions. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeEntitySentimentCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeEntitySentimentResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - analyzeEntitySentimentCallable() { - return stub.analyzeEntitySentimentCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSyntaxResponse analyzeSyntax(Document document) { - AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder().setDocument(document).build(); - return analyzeSyntax(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSyntaxResponse analyzeSyntax(Document document, EncodingType encodingType) { - AnalyzeSyntaxRequest request = - AnalyzeSyntaxRequest.newBuilder() - .setDocument(document) - .setEncodingType(encodingType) - .build(); - return analyzeSyntax(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnalyzeSyntaxResponse analyzeSyntax(AnalyzeSyntaxRequest request) { - return analyzeSyntaxCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the syntax of the text and provides sentence boundaries and tokenization along with - * part of speech tags, dependency trees, and other properties. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.analyzeSyntaxCallable().futureCall(request);
-   *   // Do something.
-   *   AnalyzeSyntaxResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable analyzeSyntaxCallable() { - return stub.analyzeSyntaxCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Classifies a document into categories. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   ClassifyTextResponse response = languageServiceClient.classifyText(document);
-   * }
-   * }
- * - * @param document Required. Input document. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ClassifyTextResponse classifyText(Document document) { - ClassifyTextRequest request = ClassifyTextRequest.newBuilder().setDocument(document).build(); - return classifyText(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Classifies a document into categories. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setClassificationModelOptions(ClassificationModelOptions.newBuilder().build())
-   *           .build();
-   *   ClassifyTextResponse response = languageServiceClient.classifyText(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ClassifyTextResponse classifyText(ClassifyTextRequest request) { - return classifyTextCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Classifies a document into categories. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setClassificationModelOptions(ClassificationModelOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.classifyTextCallable().futureCall(request);
-   *   // Do something.
-   *   ClassifyTextResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable classifyTextCallable() { - return stub.classifyTextCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all syntax, sentiment, entity, and classification features - * in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   AnnotateTextResponse response = languageServiceClient.annotateText(document, features);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param features Required. The enabled features. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnnotateTextResponse annotateText( - Document document, AnnotateTextRequest.Features features) { - AnnotateTextRequest request = - AnnotateTextRequest.newBuilder().setDocument(document).setFeatures(features).build(); - return annotateText(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all syntax, sentiment, entity, and classification features - * in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnnotateTextResponse response =
-   *       languageServiceClient.annotateText(document, features, encodingType);
-   * }
-   * }
- * - * @param document Required. Input document. - * @param features Required. The enabled features. - * @param encodingType The encoding type used by the API to calculate offsets. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnnotateTextResponse annotateText( - Document document, AnnotateTextRequest.Features features, EncodingType encodingType) { - AnnotateTextRequest request = - AnnotateTextRequest.newBuilder() - .setDocument(document) - .setFeatures(features) - .setEncodingType(encodingType) - .build(); - return annotateText(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all syntax, sentiment, entity, and classification features - * in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   AnnotateTextResponse response = languageServiceClient.annotateText(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final AnnotateTextResponse annotateText(AnnotateTextRequest request) { - return annotateTextCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * A convenience method that provides all syntax, sentiment, entity, and classification features - * in one call. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .setEncodingType(EncodingType.forNumber(0))
-   *           .build();
-   *   ApiFuture future =
-   *       languageServiceClient.annotateTextCallable().futureCall(request);
-   *   // Do something.
-   *   AnnotateTextResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable annotateTextCallable() { - return stub.annotateTextCallable(); - } - - @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-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceSettings.java deleted file mode 100644 index 5d2d0dbb..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceSettings.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2; - -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.httpjson.InstantiatingHttpJsonChannelProvider; -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.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.language.v1beta2.stub.LanguageServiceStubSettings; -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 LanguageServiceClient}. - * - *

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

    - *
  • The default service address (language.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 analyzeSentiment to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceSettings.newBuilder();
- * languageServiceSettingsBuilder
- *     .analyzeSentimentSettings()
- *     .setRetrySettings(
- *         languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LanguageServiceSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class LanguageServiceSettings extends ClientSettings { - - /** Returns the object with the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings - analyzeSentimentSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeSentimentSettings(); - } - - /** Returns the object with the settings used for calls to analyzeEntities. */ - public UnaryCallSettings - analyzeEntitiesSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeEntitiesSettings(); - } - - /** Returns the object with the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings - analyzeEntitySentimentSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeEntitySentimentSettings(); - } - - /** Returns the object with the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings analyzeSyntaxSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).analyzeSyntaxSettings(); - } - - /** Returns the object with the settings used for calls to classifyText. */ - public UnaryCallSettings classifyTextSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).classifyTextSettings(); - } - - /** Returns the object with the settings used for calls to annotateText. */ - public UnaryCallSettings annotateTextSettings() { - return ((LanguageServiceStubSettings) getStubSettings()).annotateTextSettings(); - } - - public static final LanguageServiceSettings create(LanguageServiceStubSettings stub) - throws IOException { - return new LanguageServiceSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return LanguageServiceStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return LanguageServiceStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return LanguageServiceStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return LanguageServiceStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return LanguageServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return LanguageServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return LanguageServiceStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return LanguageServiceStubSettings.defaultApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - @BetaApi - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** 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 LanguageServiceSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for LanguageServiceSettings. */ - public static class Builder extends ClientSettings.Builder { - - protected Builder() throws IOException { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(LanguageServiceStubSettings.newBuilder(clientContext)); - } - - protected Builder(LanguageServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(LanguageServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - private static Builder createDefault() { - return new Builder(LanguageServiceStubSettings.newBuilder()); - } - - @BetaApi - private static Builder createHttpJsonDefault() { - return new Builder(LanguageServiceStubSettings.newHttpJsonBuilder()); - } - - public LanguageServiceStubSettings.Builder getStubSettingsBuilder() { - return ((LanguageServiceStubSettings.Builder) getStubSettings()); - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings.Builder - analyzeSentimentSettings() { - return getStubSettingsBuilder().analyzeSentimentSettings(); - } - - /** Returns the builder for the settings used for calls to analyzeEntities. */ - public UnaryCallSettings.Builder - analyzeEntitiesSettings() { - return getStubSettingsBuilder().analyzeEntitiesSettings(); - } - - /** Returns the builder for the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings.Builder - analyzeEntitySentimentSettings() { - return getStubSettingsBuilder().analyzeEntitySentimentSettings(); - } - - /** Returns the builder for the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings.Builder - analyzeSyntaxSettings() { - return getStubSettingsBuilder().analyzeSyntaxSettings(); - } - - /** Returns the builder for the settings used for calls to classifyText. */ - public UnaryCallSettings.Builder - classifyTextSettings() { - return getStubSettingsBuilder().classifyTextSettings(); - } - - /** Returns the builder for the settings used for calls to annotateText. */ - public UnaryCallSettings.Builder - annotateTextSettings() { - return getStubSettingsBuilder().annotateTextSettings(); - } - - @Override - public LanguageServiceSettings build() throws IOException { - return new LanguageServiceSettings(this); - } - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/gapic_metadata.json b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/gapic_metadata.json deleted file mode 100644 index 00621e6f..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/gapic_metadata.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "java", - "protoPackage": "google.cloud.language.v1beta2", - "libraryPackage": "com.google.cloud.language.v1beta2", - "services": { - "LanguageService": { - "clients": { - "grpc": { - "libraryClient": "LanguageServiceClient", - "rpcs": { - "AnalyzeEntities": { - "methods": ["analyzeEntities", "analyzeEntities", "analyzeEntities", "analyzeEntitiesCallable"] - }, - "AnalyzeEntitySentiment": { - "methods": ["analyzeEntitySentiment", "analyzeEntitySentiment", "analyzeEntitySentiment", "analyzeEntitySentimentCallable"] - }, - "AnalyzeSentiment": { - "methods": ["analyzeSentiment", "analyzeSentiment", "analyzeSentiment", "analyzeSentimentCallable"] - }, - "AnalyzeSyntax": { - "methods": ["analyzeSyntax", "analyzeSyntax", "analyzeSyntax", "analyzeSyntaxCallable"] - }, - "AnnotateText": { - "methods": ["annotateText", "annotateText", "annotateText", "annotateTextCallable"] - }, - "ClassifyText": { - "methods": ["classifyText", "classifyText", "classifyTextCallable"] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/package-info.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/package-info.java deleted file mode 100644 index 9575cab4..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/package-info.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 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 Natural Language API - * - *

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

======================= LanguageServiceClient ======================= - * - *

Service Description: Provides text analysis operations such as sentiment analysis and entity - * recognition. - * - *

Sample for LanguageServiceClient: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
- *   Document document = Document.newBuilder().build();
- *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
- * }
- * }
- */ -@Generated("by gapic-generator-java") -package com.google.cloud.language.v1beta2; - -import javax.annotation.Generated; diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceCallableFactory.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceCallableFactory.java deleted file mode 100644 index 8e87bd16..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceCallableFactory.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcCallableFactory; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC callable factory implementation for the LanguageService service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcLanguageServiceCallableFactory implements GrpcStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - GrpcCallSettings grpcCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - GrpcCallSettings grpcCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, callSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings callSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, callSettings, clientContext); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceStub.java deleted file mode 100644 index 50367841..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceStub.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2.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.UnaryCallable; -import com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeSentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1beta2.AnnotateTextRequest; -import com.google.cloud.language.v1beta2.AnnotateTextResponse; -import com.google.cloud.language.v1beta2.ClassifyTextRequest; -import com.google.cloud.language.v1beta2.ClassifyTextResponse; -import com.google.longrunning.stub.GrpcOperationsStub; -import io.grpc.MethodDescriptor; -import io.grpc.protobuf.ProtoUtils; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC stub implementation for the LanguageService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class GrpcLanguageServiceStub extends LanguageServiceStub { - private static final MethodDescriptor - analyzeSentimentMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnalyzeSentiment") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeSentimentRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeSentimentResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - analyzeEntitiesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnalyzeEntities") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeEntitiesRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeEntitiesResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor< - AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> - analyzeEntitySentimentMethodDescriptor = - MethodDescriptor - .newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - "google.cloud.language.v1beta2.LanguageService/AnalyzeEntitySentiment") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeEntitySentimentRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeEntitySentimentResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - analyzeSyntaxMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnalyzeSyntax") - .setRequestMarshaller( - ProtoUtils.marshaller(AnalyzeSyntaxRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnalyzeSyntaxResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - classifyTextMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/ClassifyText") - .setRequestMarshaller(ProtoUtils.marshaller(ClassifyTextRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ClassifyTextResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - annotateTextMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnnotateText") - .setRequestMarshaller(ProtoUtils.marshaller(AnnotateTextRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(AnnotateTextResponse.getDefaultInstance())) - .build(); - - private final UnaryCallable - analyzeSentimentCallable; - private final UnaryCallable - analyzeEntitiesCallable; - private final UnaryCallable - analyzeEntitySentimentCallable; - private final UnaryCallable analyzeSyntaxCallable; - private final UnaryCallable classifyTextCallable; - private final UnaryCallable annotateTextCallable; - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final GrpcStubCallableFactory callableFactory; - - public static final GrpcLanguageServiceStub create(LanguageServiceStubSettings settings) - throws IOException { - return new GrpcLanguageServiceStub(settings, ClientContext.create(settings)); - } - - public static final GrpcLanguageServiceStub create(ClientContext clientContext) - throws IOException { - return new GrpcLanguageServiceStub( - LanguageServiceStubSettings.newBuilder().build(), clientContext); - } - - public static final GrpcLanguageServiceStub create( - ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { - return new GrpcLanguageServiceStub( - LanguageServiceStubSettings.newBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of GrpcLanguageServiceStub, 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 GrpcLanguageServiceStub( - LanguageServiceStubSettings settings, ClientContext clientContext) throws IOException { - this(settings, clientContext, new GrpcLanguageServiceCallableFactory()); - } - - /** - * Constructs an instance of GrpcLanguageServiceStub, 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 GrpcLanguageServiceStub( - LanguageServiceStubSettings settings, - ClientContext clientContext, - GrpcStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - - GrpcCallSettings - analyzeSentimentTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(analyzeSentimentMethodDescriptor) - .build(); - GrpcCallSettings - analyzeEntitiesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(analyzeEntitiesMethodDescriptor) - .build(); - GrpcCallSettings - analyzeEntitySentimentTransportSettings = - GrpcCallSettings - .newBuilder() - .setMethodDescriptor(analyzeEntitySentimentMethodDescriptor) - .build(); - GrpcCallSettings analyzeSyntaxTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(analyzeSyntaxMethodDescriptor) - .build(); - GrpcCallSettings classifyTextTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(classifyTextMethodDescriptor) - .build(); - GrpcCallSettings annotateTextTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(annotateTextMethodDescriptor) - .build(); - - this.analyzeSentimentCallable = - callableFactory.createUnaryCallable( - analyzeSentimentTransportSettings, settings.analyzeSentimentSettings(), clientContext); - this.analyzeEntitiesCallable = - callableFactory.createUnaryCallable( - analyzeEntitiesTransportSettings, settings.analyzeEntitiesSettings(), clientContext); - this.analyzeEntitySentimentCallable = - callableFactory.createUnaryCallable( - analyzeEntitySentimentTransportSettings, - settings.analyzeEntitySentimentSettings(), - clientContext); - this.analyzeSyntaxCallable = - callableFactory.createUnaryCallable( - analyzeSyntaxTransportSettings, settings.analyzeSyntaxSettings(), clientContext); - this.classifyTextCallable = - callableFactory.createUnaryCallable( - classifyTextTransportSettings, settings.classifyTextSettings(), clientContext); - this.annotateTextCallable = - callableFactory.createUnaryCallable( - annotateTextTransportSettings, settings.annotateTextSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - @Override - public UnaryCallable - analyzeSentimentCallable() { - return analyzeSentimentCallable; - } - - @Override - public UnaryCallable analyzeEntitiesCallable() { - return analyzeEntitiesCallable; - } - - @Override - public UnaryCallable - analyzeEntitySentimentCallable() { - return analyzeEntitySentimentCallable; - } - - @Override - public UnaryCallable analyzeSyntaxCallable() { - return analyzeSyntaxCallable; - } - - @Override - public UnaryCallable classifyTextCallable() { - return classifyTextCallable; - } - - @Override - public UnaryCallable annotateTextCallable() { - return annotateTextCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceCallableFactory.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceCallableFactory.java deleted file mode 100644 index 6dc0b789..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceCallableFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonCallableFactory; -import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.ClientContext; -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.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST callable factory implementation for the LanguageService service API. - * - *

This class is for advanced usage. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class HttpJsonLanguageServiceCallableFactory - implements HttpJsonStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - HttpJsonCallSettings httpJsonCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createUnaryCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - HttpJsonCallSettings httpJsonCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createPagedCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - HttpJsonCallSettings httpJsonCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createBatchingCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - @Override - public - OperationCallable createOperationCallable( - HttpJsonCallSettings httpJsonCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - UnaryCallable innerCallable = - HttpJsonCallableFactory.createBaseUnaryCallable( - httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); - HttpJsonOperationSnapshotCallable initialCallable = - new HttpJsonOperationSnapshotCallable( - innerCallable, - httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); - return HttpJsonCallableFactory.createOperationCallable( - callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - HttpJsonCallSettings httpJsonCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createServerStreamingCallable( - httpJsonCallSettings, callSettings, clientContext); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceStub.java deleted file mode 100644 index f177a261..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceStub.java +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2.stub; - -import com.google.api.core.BetaApi; -import com.google.api.core.InternalApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.httpjson.ApiMethodDescriptor; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; -import com.google.api.gax.httpjson.ProtoMessageResponseParser; -import com.google.api.gax.httpjson.ProtoRestSerializer; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeSentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1beta2.AnnotateTextRequest; -import com.google.cloud.language.v1beta2.AnnotateTextResponse; -import com.google.cloud.language.v1beta2.ClassifyTextRequest; -import com.google.cloud.language.v1beta2.ClassifyTextResponse; -import com.google.protobuf.TypeRegistry; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST stub implementation for the LanguageService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public class HttpJsonLanguageServiceStub extends LanguageServiceStub { - private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); - - private static final ApiMethodDescriptor - analyzeSentimentMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnalyzeSentiment") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta2/documents:analyzeSentiment", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeSentimentResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - analyzeEntitiesMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnalyzeEntities") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta2/documents:analyzeEntities", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeEntitiesResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor< - AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> - analyzeEntitySentimentMethodDescriptor = - ApiMethodDescriptor - .newBuilder() - .setFullMethodName( - "google.cloud.language.v1beta2.LanguageService/AnalyzeEntitySentiment") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta2/documents:analyzeEntitySentiment", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeEntitySentimentResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - analyzeSyntaxMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnalyzeSyntax") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta2/documents:analyzeSyntax", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnalyzeSyntaxResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - classifyTextMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/ClassifyText") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta2/documents:classifyText", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ClassifyTextResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - annotateTextMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.language.v1beta2.LanguageService/AnnotateText") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1beta2/documents:annotateText", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(AnnotateTextResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private final UnaryCallable - analyzeSentimentCallable; - private final UnaryCallable - analyzeEntitiesCallable; - private final UnaryCallable - analyzeEntitySentimentCallable; - private final UnaryCallable analyzeSyntaxCallable; - private final UnaryCallable classifyTextCallable; - private final UnaryCallable annotateTextCallable; - - private final BackgroundResource backgroundResources; - private final HttpJsonStubCallableFactory callableFactory; - - public static final HttpJsonLanguageServiceStub create(LanguageServiceStubSettings settings) - throws IOException { - return new HttpJsonLanguageServiceStub(settings, ClientContext.create(settings)); - } - - public static final HttpJsonLanguageServiceStub create(ClientContext clientContext) - throws IOException { - return new HttpJsonLanguageServiceStub( - LanguageServiceStubSettings.newHttpJsonBuilder().build(), clientContext); - } - - public static final HttpJsonLanguageServiceStub create( - ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { - return new HttpJsonLanguageServiceStub( - LanguageServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of HttpJsonLanguageServiceStub, 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 HttpJsonLanguageServiceStub( - LanguageServiceStubSettings settings, ClientContext clientContext) throws IOException { - this(settings, clientContext, new HttpJsonLanguageServiceCallableFactory()); - } - - /** - * Constructs an instance of HttpJsonLanguageServiceStub, 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 HttpJsonLanguageServiceStub( - LanguageServiceStubSettings settings, - ClientContext clientContext, - HttpJsonStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - - HttpJsonCallSettings - analyzeSentimentTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(analyzeSentimentMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - analyzeEntitiesTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(analyzeEntitiesMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - analyzeEntitySentimentTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(analyzeEntitySentimentMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - analyzeSyntaxTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(analyzeSyntaxMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings classifyTextTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(classifyTextMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings annotateTextTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(annotateTextMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - - this.analyzeSentimentCallable = - callableFactory.createUnaryCallable( - analyzeSentimentTransportSettings, settings.analyzeSentimentSettings(), clientContext); - this.analyzeEntitiesCallable = - callableFactory.createUnaryCallable( - analyzeEntitiesTransportSettings, settings.analyzeEntitiesSettings(), clientContext); - this.analyzeEntitySentimentCallable = - callableFactory.createUnaryCallable( - analyzeEntitySentimentTransportSettings, - settings.analyzeEntitySentimentSettings(), - clientContext); - this.analyzeSyntaxCallable = - callableFactory.createUnaryCallable( - analyzeSyntaxTransportSettings, settings.analyzeSyntaxSettings(), clientContext); - this.classifyTextCallable = - callableFactory.createUnaryCallable( - classifyTextTransportSettings, settings.classifyTextSettings(), clientContext); - this.annotateTextCallable = - callableFactory.createUnaryCallable( - annotateTextTransportSettings, settings.annotateTextSettings(), clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - @InternalApi - public static List getMethodDescriptors() { - List methodDescriptors = new ArrayList<>(); - methodDescriptors.add(analyzeSentimentMethodDescriptor); - methodDescriptors.add(analyzeEntitiesMethodDescriptor); - methodDescriptors.add(analyzeEntitySentimentMethodDescriptor); - methodDescriptors.add(analyzeSyntaxMethodDescriptor); - methodDescriptors.add(classifyTextMethodDescriptor); - methodDescriptors.add(annotateTextMethodDescriptor); - return methodDescriptors; - } - - @Override - public UnaryCallable - analyzeSentimentCallable() { - return analyzeSentimentCallable; - } - - @Override - public UnaryCallable analyzeEntitiesCallable() { - return analyzeEntitiesCallable; - } - - @Override - public UnaryCallable - analyzeEntitySentimentCallable() { - return analyzeEntitySentimentCallable; - } - - @Override - public UnaryCallable analyzeSyntaxCallable() { - return analyzeSyntaxCallable; - } - - @Override - public UnaryCallable classifyTextCallable() { - return classifyTextCallable; - } - - @Override - public UnaryCallable annotateTextCallable() { - return annotateTextCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStub.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStub.java deleted file mode 100644 index de46558e..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStub.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeSentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1beta2.AnnotateTextRequest; -import com.google.cloud.language.v1beta2.AnnotateTextResponse; -import com.google.cloud.language.v1beta2.ClassifyTextRequest; -import com.google.cloud.language.v1beta2.ClassifyTextResponse; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Base stub class for the LanguageService service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@BetaApi -@Generated("by gapic-generator-java") -public abstract class LanguageServiceStub implements BackgroundResource { - - public UnaryCallable - analyzeSentimentCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeSentimentCallable()"); - } - - public UnaryCallable analyzeEntitiesCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeEntitiesCallable()"); - } - - public UnaryCallable - analyzeEntitySentimentCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeEntitySentimentCallable()"); - } - - public UnaryCallable analyzeSyntaxCallable() { - throw new UnsupportedOperationException("Not implemented: analyzeSyntaxCallable()"); - } - - public UnaryCallable classifyTextCallable() { - throw new UnsupportedOperationException("Not implemented: classifyTextCallable()"); - } - - public UnaryCallable annotateTextCallable() { - throw new UnsupportedOperationException("Not implemented: annotateTextCallable()"); - } - - @Override - public abstract void close(); -} diff --git a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStubSettings.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStubSettings.java deleted file mode 100644 index ea0e4565..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStubSettings.java +++ /dev/null @@ -1,470 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2.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.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.HttpJsonTransportChannel; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -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.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.language.v1beta2.AnalyzeEntitiesRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSentimentRequest; -import com.google.cloud.language.v1beta2.AnalyzeSentimentResponse; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse; -import com.google.cloud.language.v1beta2.AnnotateTextRequest; -import com.google.cloud.language.v1beta2.AnnotateTextResponse; -import com.google.cloud.language.v1beta2.ClassifyTextRequest; -import com.google.cloud.language.v1beta2.ClassifyTextResponse; -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 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 LanguageServiceStub}. - * - *

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

    - *
  • The default service address (language.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 analyzeSentiment to 30 seconds: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * LanguageServiceStubSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceStubSettings.newBuilder();
- * languageServiceSettingsBuilder
- *     .analyzeSentimentSettings()
- *     .setRetrySettings(
- *         languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * LanguageServiceStubSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * }
- */ -@BetaApi -@Generated("by gapic-generator-java") -public class LanguageServiceStubSettings extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder() - .add("https://www.googleapis.com/auth/cloud-language") - .add("https://www.googleapis.com/auth/cloud-platform") - .build(); - - private final UnaryCallSettings - analyzeSentimentSettings; - private final UnaryCallSettings - analyzeEntitiesSettings; - private final UnaryCallSettings - analyzeEntitySentimentSettings; - private final UnaryCallSettings - analyzeSyntaxSettings; - private final UnaryCallSettings classifyTextSettings; - private final UnaryCallSettings annotateTextSettings; - - /** Returns the object with the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings - analyzeSentimentSettings() { - return analyzeSentimentSettings; - } - - /** Returns the object with the settings used for calls to analyzeEntities. */ - public UnaryCallSettings - analyzeEntitiesSettings() { - return analyzeEntitiesSettings; - } - - /** Returns the object with the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings - analyzeEntitySentimentSettings() { - return analyzeEntitySentimentSettings; - } - - /** Returns the object with the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings analyzeSyntaxSettings() { - return analyzeSyntaxSettings; - } - - /** Returns the object with the settings used for calls to classifyText. */ - public UnaryCallSettings classifyTextSettings() { - return classifyTextSettings; - } - - /** Returns the object with the settings used for calls to annotateText. */ - public UnaryCallSettings annotateTextSettings() { - return annotateTextSettings; - } - - public LanguageServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcLanguageServiceStub.create(this); - } - if (getTransportChannelProvider() - .getTransportName() - .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { - return HttpJsonLanguageServiceStub.create(this); - } - throw new UnsupportedOperationException( - String.format( - "Transport not supported: %s", 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 "language.googleapis.com:443"; - } - - /** Returns the default mTLS service endpoint. */ - public static String getDefaultMtlsEndpoint() { - return "language.mtls.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder() - .setScopesToApply(DEFAULT_SERVICE_SCOPES) - .setUseJwtAccessWithScope(true); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return InstantiatingHttpJsonChannelProvider.newBuilder(); - } - - 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 defaultGrpcApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(LanguageServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(LanguageServiceStubSettings.class)) - .setTransportToken( - GaxHttpJsonProperties.getHttpJsonTokenName(), - GaxHttpJsonProperties.getHttpJsonVersion()); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return LanguageServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** 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 LanguageServiceStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - analyzeSentimentSettings = settingsBuilder.analyzeSentimentSettings().build(); - analyzeEntitiesSettings = settingsBuilder.analyzeEntitiesSettings().build(); - analyzeEntitySentimentSettings = settingsBuilder.analyzeEntitySentimentSettings().build(); - analyzeSyntaxSettings = settingsBuilder.analyzeSyntaxSettings().build(); - classifyTextSettings = settingsBuilder.classifyTextSettings().build(); - annotateTextSettings = settingsBuilder.annotateTextSettings().build(); - } - - /** Builder for LanguageServiceStubSettings. */ - public static class Builder extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder - analyzeSentimentSettings; - private final UnaryCallSettings.Builder - analyzeEntitiesSettings; - private final UnaryCallSettings.Builder< - AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> - analyzeEntitySentimentSettings; - private final UnaryCallSettings.Builder - analyzeSyntaxSettings; - private final UnaryCallSettings.Builder - classifyTextSettings; - private final UnaryCallSettings.Builder - annotateTextSettings; - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "retry_policy_0_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); - 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(600000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(600000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) - .build(); - definitions.put("retry_policy_0_params", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - analyzeSentimentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - analyzeEntitiesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - analyzeEntitySentimentSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - analyzeSyntaxSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - classifyTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - annotateTextSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - analyzeSentimentSettings, - analyzeEntitiesSettings, - analyzeEntitySentimentSettings, - analyzeSyntaxSettings, - classifyTextSettings, - annotateTextSettings); - initDefaults(this); - } - - protected Builder(LanguageServiceStubSettings settings) { - super(settings); - - analyzeSentimentSettings = settings.analyzeSentimentSettings.toBuilder(); - analyzeEntitiesSettings = settings.analyzeEntitiesSettings.toBuilder(); - analyzeEntitySentimentSettings = settings.analyzeEntitySentimentSettings.toBuilder(); - analyzeSyntaxSettings = settings.analyzeSyntaxSettings.toBuilder(); - classifyTextSettings = settings.classifyTextSettings.toBuilder(); - annotateTextSettings = settings.annotateTextSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - analyzeSentimentSettings, - analyzeEntitiesSettings, - analyzeEntitySentimentSettings, - analyzeSyntaxSettings, - classifyTextSettings, - annotateTextSettings); - } - - private static Builder createDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder createHttpJsonDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - builder - .analyzeSentimentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .analyzeEntitiesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .analyzeEntitySentimentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .analyzeSyntaxSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .classifyTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - builder - .annotateTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); - - return builder; - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to analyzeSentiment. */ - public UnaryCallSettings.Builder - analyzeSentimentSettings() { - return analyzeSentimentSettings; - } - - /** Returns the builder for the settings used for calls to analyzeEntities. */ - public UnaryCallSettings.Builder - analyzeEntitiesSettings() { - return analyzeEntitiesSettings; - } - - /** Returns the builder for the settings used for calls to analyzeEntitySentiment. */ - public UnaryCallSettings.Builder - analyzeEntitySentimentSettings() { - return analyzeEntitySentimentSettings; - } - - /** Returns the builder for the settings used for calls to analyzeSyntax. */ - public UnaryCallSettings.Builder - analyzeSyntaxSettings() { - return analyzeSyntaxSettings; - } - - /** Returns the builder for the settings used for calls to classifyText. */ - public UnaryCallSettings.Builder - classifyTextSettings() { - return classifyTextSettings; - } - - /** Returns the builder for the settings used for calls to annotateText. */ - public UnaryCallSettings.Builder - annotateTextSettings() { - return annotateTextSettings; - } - - @Override - public LanguageServiceStubSettings build() throws IOException { - return new LanguageServiceStubSettings(this); - } - } -} diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientHttpJsonTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientHttpJsonTest.java deleted file mode 100644 index 826e982e..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientHttpJsonTest.java +++ /dev/null @@ -1,595 +0,0 @@ -/* - * Copyright 2022 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.language.v1; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.testing.MockHttpService; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ApiException; -import com.google.api.gax.rpc.ApiExceptionFactory; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.testing.FakeStatusCode; -import com.google.cloud.language.v1.stub.HttpJsonLanguageServiceStub; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class LanguageServiceClientHttpJsonTest { - private static MockHttpService mockService; - private static LanguageServiceClient client; - - @BeforeClass - public static void startStaticServer() throws IOException { - mockService = - new MockHttpService( - HttpJsonLanguageServiceStub.getMethodDescriptors(), - LanguageServiceSettings.getDefaultEndpoint()); - LanguageServiceSettings settings = - LanguageServiceSettings.newHttpJsonBuilder() - .setTransportChannelProvider( - LanguageServiceSettings.defaultHttpJsonTransportProviderBuilder() - .setHttpTransport(mockService) - .build()) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = LanguageServiceClient.create(settings); - } - - @AfterClass - public static void stopServer() { - client.close(); - } - - @Before - public void setUp() {} - - @After - public void tearDown() throws Exception { - mockService.reset(); - } - - @Test - public void analyzeSentimentTest() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSentimentExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSentimentTest2() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSentimentExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitiesExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntities(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest2() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitiesExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntities(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitySentimentExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntitySentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest2() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitySentimentResponse actualResponse = - client.analyzeEntitySentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitySentimentExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntitySentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSyntaxExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSyntax(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest2() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSyntaxExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSyntax(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void classifyTextTest() throws Exception { - ClassifyTextResponse expectedResponse = - ClassifyTextResponse.newBuilder() - .addAllCategories(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - ClassifyTextResponse actualResponse = client.classifyText(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void classifyTextExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.classifyText(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - - AnnotateTextResponse actualResponse = client.annotateText(document, features); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void annotateTextExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - client.annotateText(document, features); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest2() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnnotateTextResponse actualResponse = client.annotateText(document, features, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void annotateTextExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.annotateText(document, features, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java deleted file mode 100644 index a896aa72..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Copyright 2022 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.language.v1; - -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.protobuf.AbstractMessage; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class LanguageServiceClientTest { - private static MockLanguageService mockLanguageService; - private static MockServiceHelper mockServiceHelper; - private LocalChannelProvider channelProvider; - private LanguageServiceClient client; - - @BeforeClass - public static void startStaticServer() { - mockLanguageService = new MockLanguageService(); - mockServiceHelper = - new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockLanguageService)); - mockServiceHelper.start(); - } - - @AfterClass - public static void stopServer() { - mockServiceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - mockServiceHelper.reset(); - channelProvider = mockServiceHelper.createChannelProvider(); - LanguageServiceSettings settings = - LanguageServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = LanguageServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - public void analyzeSentimentTest() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSentimentRequest actualRequest = ((AnalyzeSentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSentimentTest2() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSentimentRequest actualRequest = ((AnalyzeSentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSentimentExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitiesRequest actualRequest = ((AnalyzeEntitiesRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitiesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntities(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest2() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitiesRequest actualRequest = ((AnalyzeEntitiesRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitiesExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntities(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitySentimentRequest actualRequest = - ((AnalyzeEntitySentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitySentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntitySentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest2() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitySentimentResponse actualResponse = - client.analyzeEntitySentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitySentimentRequest actualRequest = - ((AnalyzeEntitySentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitySentimentExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntitySentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSyntaxRequest actualRequest = ((AnalyzeSyntaxRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSyntaxExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSyntax(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest2() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSyntaxRequest actualRequest = ((AnalyzeSyntaxRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSyntaxExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSyntax(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void classifyTextTest() throws Exception { - ClassifyTextResponse expectedResponse = - ClassifyTextResponse.newBuilder() - .addAllCategories(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - ClassifyTextResponse actualResponse = client.classifyText(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ClassifyTextRequest actualRequest = ((ClassifyTextRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void classifyTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.classifyText(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - - AnnotateTextResponse actualResponse = client.annotateText(document, features); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnnotateTextRequest actualRequest = ((AnnotateTextRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(features, actualRequest.getFeatures()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void annotateTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - client.annotateText(document, features); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest2() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnnotateTextResponse actualResponse = client.annotateText(document, features, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnnotateTextRequest actualRequest = ((AnnotateTextRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(features, actualRequest.getFeatures()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void annotateTextExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.annotateText(document, features, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java deleted file mode 100644 index ce5bbe58..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2022 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.language.v1; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockLanguageService implements MockGrpcService { - private final MockLanguageServiceImpl serviceImpl; - - public MockLanguageService() { - serviceImpl = new MockLanguageServiceImpl(); - } - - @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-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java deleted file mode 100644 index a7eddf3e..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2022 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.language.v1; - -import com.google.api.core.BetaApi; -import com.google.cloud.language.v1.LanguageServiceGrpc.LanguageServiceImplBase; -import com.google.protobuf.AbstractMessage; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockLanguageServiceImpl extends LanguageServiceImplBase { - private List requests; - private Queue responses; - - public MockLanguageServiceImpl() { - 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 analyzeSentiment( - AnalyzeSentimentRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeSentimentResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeSentimentResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeSentiment, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeSentimentResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void analyzeEntities( - AnalyzeEntitiesRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeEntitiesResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeEntitiesResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeEntities, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeEntitiesResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void analyzeEntitySentiment( - AnalyzeEntitySentimentRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeEntitySentimentResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeEntitySentimentResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeEntitySentiment, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeEntitySentimentResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void analyzeSyntax( - AnalyzeSyntaxRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeSyntaxResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeSyntaxResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeSyntax, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeSyntaxResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void classifyText( - ClassifyTextRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof ClassifyTextResponse) { - requests.add(request); - responseObserver.onNext(((ClassifyTextResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method ClassifyText, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - ClassifyTextResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void annotateText( - AnnotateTextRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnnotateTextResponse) { - requests.add(request); - responseObserver.onNext(((AnnotateTextResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnnotateText, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnnotateTextResponse.class.getName(), - Exception.class.getName()))); - } - } -} diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientHttpJsonTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientHttpJsonTest.java deleted file mode 100644 index 265854d8..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientHttpJsonTest.java +++ /dev/null @@ -1,595 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.testing.MockHttpService; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ApiException; -import com.google.api.gax.rpc.ApiExceptionFactory; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.testing.FakeStatusCode; -import com.google.cloud.language.v1beta2.stub.HttpJsonLanguageServiceStub; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class LanguageServiceClientHttpJsonTest { - private static MockHttpService mockService; - private static LanguageServiceClient client; - - @BeforeClass - public static void startStaticServer() throws IOException { - mockService = - new MockHttpService( - HttpJsonLanguageServiceStub.getMethodDescriptors(), - LanguageServiceSettings.getDefaultEndpoint()); - LanguageServiceSettings settings = - LanguageServiceSettings.newHttpJsonBuilder() - .setTransportChannelProvider( - LanguageServiceSettings.defaultHttpJsonTransportProviderBuilder() - .setHttpTransport(mockService) - .build()) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = LanguageServiceClient.create(settings); - } - - @AfterClass - public static void stopServer() { - client.close(); - } - - @Before - public void setUp() {} - - @After - public void tearDown() throws Exception { - mockService.reset(); - } - - @Test - public void analyzeSentimentTest() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSentimentExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSentimentTest2() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSentimentExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitiesExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntities(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest2() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitiesExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntities(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitySentimentExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntitySentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest2() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitySentimentResponse actualResponse = - client.analyzeEntitySentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeEntitySentimentExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntitySentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSyntaxExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSyntax(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest2() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void analyzeSyntaxExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSyntax(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void classifyTextTest() throws Exception { - ClassifyTextResponse expectedResponse = - ClassifyTextResponse.newBuilder() - .addAllCategories(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - ClassifyTextResponse actualResponse = client.classifyText(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void classifyTextExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.classifyText(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - - AnnotateTextResponse actualResponse = client.annotateText(document, features); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void annotateTextExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - client.annotateText(document, features); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest2() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnnotateTextResponse actualResponse = client.annotateText(document, features, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void annotateTextExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.annotateText(document, features, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientTest.java deleted file mode 100644 index fba3f927..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientTest.java +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2; - -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.protobuf.AbstractMessage; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import javax.annotation.Generated; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@Generated("by gapic-generator-java") -public class LanguageServiceClientTest { - private static MockLanguageService mockLanguageService; - private static MockServiceHelper mockServiceHelper; - private LocalChannelProvider channelProvider; - private LanguageServiceClient client; - - @BeforeClass - public static void startStaticServer() { - mockLanguageService = new MockLanguageService(); - mockServiceHelper = - new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockLanguageService)); - mockServiceHelper.start(); - } - - @AfterClass - public static void stopServer() { - mockServiceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - mockServiceHelper.reset(); - channelProvider = mockServiceHelper.createChannelProvider(); - LanguageServiceSettings settings = - LanguageServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = LanguageServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - public void analyzeSentimentTest() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSentimentRequest actualRequest = ((AnalyzeSentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSentimentTest2() throws Exception { - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder() - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllSentences(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSentimentRequest actualRequest = ((AnalyzeSentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSentimentExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitiesRequest actualRequest = ((AnalyzeEntitiesRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitiesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntities(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitiesTest2() throws Exception { - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitiesRequest actualRequest = ((AnalyzeEntitiesRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitiesExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntities(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitySentimentRequest actualRequest = - ((AnalyzeEntitySentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitySentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeEntitySentiment(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeEntitySentimentTest2() throws Exception { - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder() - .addAllEntities(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeEntitySentimentResponse actualResponse = - client.analyzeEntitySentiment(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeEntitySentimentRequest actualRequest = - ((AnalyzeEntitySentimentRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeEntitySentimentExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeEntitySentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSyntaxRequest actualRequest = ((AnalyzeSyntaxRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSyntaxExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.analyzeSyntax(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void analyzeSyntaxTest2() throws Exception { - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .setLanguage("language-1613589672") - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnalyzeSyntaxRequest actualRequest = ((AnalyzeSyntaxRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void analyzeSyntaxExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.analyzeSyntax(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void classifyTextTest() throws Exception { - ClassifyTextResponse expectedResponse = - ClassifyTextResponse.newBuilder() - .addAllCategories(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - - ClassifyTextResponse actualResponse = client.classifyText(document); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ClassifyTextRequest actualRequest = ((ClassifyTextRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void classifyTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - client.classifyText(document); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - - AnnotateTextResponse actualResponse = client.annotateText(document, features); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnnotateTextRequest actualRequest = ((AnnotateTextRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(features, actualRequest.getFeatures()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void annotateTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - client.annotateText(document, features); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void annotateTextTest2() throws Exception { - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder() - .addAllSentences(new ArrayList()) - .addAllTokens(new ArrayList()) - .addAllEntities(new ArrayList()) - .setDocumentSentiment(Sentiment.newBuilder().build()) - .setLanguage("language-1613589672") - .addAllCategories(new ArrayList()) - .build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - - AnnotateTextResponse actualResponse = client.annotateText(document, features, encodingType); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockLanguageService.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - AnnotateTextRequest actualRequest = ((AnnotateTextRequest) actualRequests.get(0)); - - Assert.assertEquals(document, actualRequest.getDocument()); - Assert.assertEquals(features, actualRequest.getFeatures()); - Assert.assertEquals(encodingType, actualRequest.getEncodingType()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void annotateTextExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.forNumber(0); - client.annotateText(document, features, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageService.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageService.java deleted file mode 100644 index eae1bb3b..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageService.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockLanguageService implements MockGrpcService { - private final MockLanguageServiceImpl serviceImpl; - - public MockLanguageService() { - serviceImpl = new MockLanguageServiceImpl(); - } - - @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-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageServiceImpl.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageServiceImpl.java deleted file mode 100644 index 9f0d390c..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageServiceImpl.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2022 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.language.v1beta2; - -import com.google.api.core.BetaApi; -import com.google.cloud.language.v1beta2.LanguageServiceGrpc.LanguageServiceImplBase; -import com.google.protobuf.AbstractMessage; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockLanguageServiceImpl extends LanguageServiceImplBase { - private List requests; - private Queue responses; - - public MockLanguageServiceImpl() { - 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 analyzeSentiment( - AnalyzeSentimentRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeSentimentResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeSentimentResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeSentiment, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeSentimentResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void analyzeEntities( - AnalyzeEntitiesRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeEntitiesResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeEntitiesResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeEntities, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeEntitiesResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void analyzeEntitySentiment( - AnalyzeEntitySentimentRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeEntitySentimentResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeEntitySentimentResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeEntitySentiment, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeEntitySentimentResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void analyzeSyntax( - AnalyzeSyntaxRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnalyzeSyntaxResponse) { - requests.add(request); - responseObserver.onNext(((AnalyzeSyntaxResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnalyzeSyntax, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnalyzeSyntaxResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void classifyText( - ClassifyTextRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof ClassifyTextResponse) { - requests.add(request); - responseObserver.onNext(((ClassifyTextResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method ClassifyText, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - ClassifyTextResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void annotateText( - AnnotateTextRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof AnnotateTextResponse) { - requests.add(request); - responseObserver.onNext(((AnnotateTextResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method AnnotateText, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - AnnotateTextResponse.class.getName(), - Exception.class.getName()))); - } - } -} diff --git a/grpc-google-cloud-language-v1/pom.xml b/grpc-google-cloud-language-v1/pom.xml deleted file mode 100644 index e806007d..00000000 --- a/grpc-google-cloud-language-v1/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - com.google.api.grpc - grpc-google-cloud-language-v1 - 2.4.2-SNAPSHOT - grpc-google-cloud-language-v1 - GRPC library for grpc-google-cloud-language-v1 - - com.google.cloud - google-cloud-language-parent - 2.4.2-SNAPSHOT - - - - io.grpc - grpc-api - - - io.grpc - grpc-stub - - - io.grpc - grpc-protobuf - - - com.google.protobuf - protobuf-java - - - com.google.api.grpc - proto-google-cloud-language-v1 - - - com.google.guava - guava - - - - - - java9 - - [9,) - - - - javax.annotation - javax.annotation-api - - - - - - - - - org.codehaus.mojo - flatten-maven-plugin - - - - \ No newline at end of file diff --git a/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java b/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java deleted file mode 100644 index bf571966..00000000 --- a/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.cloud.language.v1; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - * - * - *
- * Provides text analysis operations such as sentiment analysis and entity
- * recognition.
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/cloud/language/v1/language_service.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class LanguageServiceGrpc { - - private LanguageServiceGrpc() {} - - public static final String SERVICE_NAME = "google.cloud.language.v1.LanguageService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeSentiment", - requestType = com.google.cloud.language.v1.AnalyzeSentimentRequest.class, - responseType = com.google.cloud.language.v1.AnalyzeSentimentResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod; - if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) { - LanguageServiceGrpc.getAnalyzeSentimentMethod = - getAnalyzeSentimentMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSentiment")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeSentimentRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeSentimentResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeSentiment")) - .build(); - } - } - } - return getAnalyzeSentimentMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntities", - requestType = com.google.cloud.language.v1.AnalyzeEntitiesRequest.class, - responseType = com.google.cloud.language.v1.AnalyzeEntitiesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod; - if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) { - LanguageServiceGrpc.getAnalyzeEntitiesMethod = - getAnalyzeEntitiesMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeEntities")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeEntitiesRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeEntitiesResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeEntities")) - .build(); - } - } - } - return getAnalyzeEntitiesMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntitySentiment", - requestType = com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.class, - responseType = com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod; - if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod) - == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod) - == null) { - LanguageServiceGrpc.getAnalyzeEntitySentimentMethod = - getAnalyzeEntitySentimentMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "AnalyzeEntitySentiment")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeEntitySentiment")) - .build(); - } - } - } - return getAnalyzeEntitySentimentMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeSyntax", - requestType = com.google.cloud.language.v1.AnalyzeSyntaxRequest.class, - responseType = com.google.cloud.language.v1.AnalyzeSyntaxResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod; - if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) { - LanguageServiceGrpc.getAnalyzeSyntaxMethod = - getAnalyzeSyntaxMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSyntax")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeSyntaxRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnalyzeSyntaxResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeSyntax")) - .build(); - } - } - } - return getAnalyzeSyntaxMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse> - getClassifyTextMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ClassifyText", - requestType = com.google.cloud.language.v1.ClassifyTextRequest.class, - responseType = com.google.cloud.language.v1.ClassifyTextResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse> - getClassifyTextMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse> - getClassifyTextMethod; - if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) { - LanguageServiceGrpc.getClassifyTextMethod = - getClassifyTextMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ClassifyText")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.ClassifyTextRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.ClassifyTextResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("ClassifyText")) - .build(); - } - } - } - return getClassifyTextMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse> - getAnnotateTextMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnnotateText", - requestType = com.google.cloud.language.v1.AnnotateTextRequest.class, - responseType = com.google.cloud.language.v1.AnnotateTextResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse> - getAnnotateTextMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse> - getAnnotateTextMethod; - if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) { - LanguageServiceGrpc.getAnnotateTextMethod = - getAnnotateTextMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnnotateText")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnnotateTextRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1.AnnotateTextResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnnotateText")) - .build(); - } - } - } - return getAnnotateTextMethod; - } - - /** Creates a new async stub that supports all call types for the service */ - public static LanguageServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public LanguageServiceStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceStub(channel, callOptions); - } - }; - return LanguageServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static LanguageServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public LanguageServiceBlockingStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceBlockingStub(channel, callOptions); - } - }; - return LanguageServiceBlockingStub.newStub(factory, channel); - } - - /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static LanguageServiceFutureStub newFutureStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public LanguageServiceFutureStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceFutureStub(channel, callOptions); - } - }; - return LanguageServiceFutureStub.newStub(factory, channel); - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public abstract static class LanguageServiceImplBase implements io.grpc.BindableService { - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public void analyzeSentiment( - com.google.cloud.language.v1.AnalyzeSentimentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeSentimentMethod(), responseObserver); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public void analyzeEntities( - com.google.cloud.language.v1.AnalyzeEntitiesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeEntitiesMethod(), responseObserver); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public void analyzeEntitySentiment( - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeEntitySentimentMethod(), responseObserver); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public void analyzeSyntax( - com.google.cloud.language.v1.AnalyzeSyntaxRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeSyntaxMethod(), responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getClassifyTextMethod(), responseObserver); - } - - /** - * - * - *
-     * A convenience method that provides all the features that analyzeSentiment,
-     * analyzeEntities, and analyzeSyntax provide in one call.
-     * 
- */ - public void annotateText( - com.google.cloud.language.v1.AnnotateTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnnotateTextMethod(), responseObserver); - } - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getAnalyzeSentimentMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse>( - this, METHODID_ANALYZE_SENTIMENT))) - .addMethod( - getAnalyzeEntitiesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse>( - this, METHODID_ANALYZE_ENTITIES))) - .addMethod( - getAnalyzeEntitySentimentMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>( - this, METHODID_ANALYZE_ENTITY_SENTIMENT))) - .addMethod( - getAnalyzeSyntaxMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse>( - this, METHODID_ANALYZE_SYNTAX))) - .addMethod( - getClassifyTextMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse>( - this, METHODID_CLASSIFY_TEXT))) - .addMethod( - getAnnotateTextMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse>( - this, METHODID_ANNOTATE_TEXT))) - .build(); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceStub - extends io.grpc.stub.AbstractAsyncStub { - private LanguageServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected LanguageServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceStub(channel, callOptions); - } - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public void analyzeSentiment( - com.google.cloud.language.v1.AnalyzeSentimentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public void analyzeEntities( - com.google.cloud.language.v1.AnalyzeEntitiesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public void analyzeEntitySentiment( - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public void analyzeSyntax( - com.google.cloud.language.v1.AnalyzeSyntaxRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getClassifyTextMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * A convenience method that provides all the features that analyzeSentiment,
-     * analyzeEntities, and analyzeSyntax provide in one call.
-     * 
- */ - public void annotateText( - com.google.cloud.language.v1.AnnotateTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnnotateTextMethod(), getCallOptions()), - request, - responseObserver); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceBlockingStub - extends io.grpc.stub.AbstractBlockingStub { - private LanguageServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected LanguageServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceBlockingStub(channel, callOptions); - } - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public com.google.cloud.language.v1.AnalyzeSentimentResponse analyzeSentiment( - com.google.cloud.language.v1.AnalyzeSentimentRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeSentimentMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public com.google.cloud.language.v1.AnalyzeEntitiesResponse analyzeEntities( - com.google.cloud.language.v1.AnalyzeEntitiesRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeEntitiesMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse analyzeEntitySentiment( - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeEntitySentimentMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public com.google.cloud.language.v1.AnalyzeSyntaxResponse analyzeSyntax( - com.google.cloud.language.v1.AnalyzeSyntaxRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeSyntaxMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public com.google.cloud.language.v1.ClassifyTextResponse classifyText( - com.google.cloud.language.v1.ClassifyTextRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getClassifyTextMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * A convenience method that provides all the features that analyzeSentiment,
-     * analyzeEntities, and analyzeSyntax provide in one call.
-     * 
- */ - public com.google.cloud.language.v1.AnnotateTextResponse annotateText( - com.google.cloud.language.v1.AnnotateTextRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnnotateTextMethod(), getCallOptions(), request); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceFutureStub - extends io.grpc.stub.AbstractFutureStub { - private LanguageServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected LanguageServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceFutureStub(channel, callOptions); - } - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1.AnalyzeSentimentResponse> - analyzeSentiment(com.google.cloud.language.v1.AnalyzeSentimentRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - analyzeEntities(com.google.cloud.language.v1.AnalyzeEntitiesRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - analyzeEntitySentiment(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - analyzeSyntax(com.google.cloud.language.v1.AnalyzeSyntaxRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1.ClassifyTextResponse> - classifyText(com.google.cloud.language.v1.ClassifyTextRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getClassifyTextMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * A convenience method that provides all the features that analyzeSentiment,
-     * analyzeEntities, and analyzeSyntax provide in one call.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1.AnnotateTextResponse> - annotateText(com.google.cloud.language.v1.AnnotateTextRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnnotateTextMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_ANALYZE_SENTIMENT = 0; - private static final int METHODID_ANALYZE_ENTITIES = 1; - private static final int METHODID_ANALYZE_ENTITY_SENTIMENT = 2; - private static final int METHODID_ANALYZE_SYNTAX = 3; - private static final int METHODID_CLASSIFY_TEXT = 4; - private static final int METHODID_ANNOTATE_TEXT = 5; - - 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 LanguageServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(LanguageServiceImplBase 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_ANALYZE_SENTIMENT: - serviceImpl.analyzeSentiment( - (com.google.cloud.language.v1.AnalyzeSentimentRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_ANALYZE_ENTITIES: - serviceImpl.analyzeEntities( - (com.google.cloud.language.v1.AnalyzeEntitiesRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_ANALYZE_ENTITY_SENTIMENT: - serviceImpl.analyzeEntitySentiment( - (com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) request, - (io.grpc.stub.StreamObserver< - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>) - responseObserver); - break; - case METHODID_ANALYZE_SYNTAX: - serviceImpl.analyzeSyntax( - (com.google.cloud.language.v1.AnalyzeSyntaxRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_CLASSIFY_TEXT: - serviceImpl.classifyText( - (com.google.cloud.language.v1.ClassifyTextRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_ANNOTATE_TEXT: - serviceImpl.annotateText( - (com.google.cloud.language.v1.AnnotateTextRequest) 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 LanguageServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, - io.grpc.protobuf.ProtoServiceDescriptorSupplier { - LanguageServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("LanguageService"); - } - } - - private static final class LanguageServiceFileDescriptorSupplier - extends LanguageServiceBaseDescriptorSupplier { - LanguageServiceFileDescriptorSupplier() {} - } - - private static final class LanguageServiceMethodDescriptorSupplier - extends LanguageServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - LanguageServiceMethodDescriptorSupplier(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 (LanguageServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = - result = - io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new LanguageServiceFileDescriptorSupplier()) - .addMethod(getAnalyzeSentimentMethod()) - .addMethod(getAnalyzeEntitiesMethod()) - .addMethod(getAnalyzeEntitySentimentMethod()) - .addMethod(getAnalyzeSyntaxMethod()) - .addMethod(getClassifyTextMethod()) - .addMethod(getAnnotateTextMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/grpc-google-cloud-language-v1beta2/pom.xml b/grpc-google-cloud-language-v1beta2/pom.xml deleted file mode 100644 index fed435ad..00000000 --- a/grpc-google-cloud-language-v1beta2/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - 4.0.0 - com.google.api.grpc - grpc-google-cloud-language-v1beta2 - 0.91.2-SNAPSHOT - grpc-google-cloud-language-v1beta2 - GRPC library for grpc-google-cloud-language-v1beta2 - - com.google.cloud - google-cloud-language-parent - 2.4.2-SNAPSHOT - - - - io.grpc - grpc-api - - - io.grpc - grpc-stub - - - io.grpc - grpc-protobuf - - - com.google.protobuf - protobuf-java - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - - - com.google.guava - guava - - - - - - java9 - - [9,) - - - - javax.annotation - javax.annotation-api - - - - - - - - - org.codehaus.mojo - flatten-maven-plugin - - - - \ No newline at end of file diff --git a/grpc-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceGrpc.java b/grpc-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceGrpc.java deleted file mode 100644 index bfe3452d..00000000 --- a/grpc-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceGrpc.java +++ /dev/null @@ -1,1006 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.cloud.language.v1beta2; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - * - * - *
- * Provides text analysis operations such as sentiment analysis and entity
- * recognition.
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/cloud/language/v1beta2/language_service.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class LanguageServiceGrpc { - - private LanguageServiceGrpc() {} - - public static final String SERVICE_NAME = "google.cloud.language.v1beta2.LanguageService"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeSentiment", - requestType = com.google.cloud.language.v1beta2.AnalyzeSentimentRequest.class, - responseType = com.google.cloud.language.v1beta2.AnalyzeSentimentResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod; - if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) { - LanguageServiceGrpc.getAnalyzeSentimentMethod = - getAnalyzeSentimentMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSentiment")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeSentiment")) - .build(); - } - } - } - return getAnalyzeSentimentMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntities", - requestType = com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest.class, - responseType = com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod; - if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) { - LanguageServiceGrpc.getAnalyzeEntitiesMethod = - getAnalyzeEntitiesMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeEntities")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeEntities")) - .build(); - } - } - } - return getAnalyzeEntitiesMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntitySentiment", - requestType = com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest.class, - responseType = com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod; - if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod) - == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod) - == null) { - LanguageServiceGrpc.getAnalyzeEntitySentimentMethod = - getAnalyzeEntitySentimentMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "AnalyzeEntitySentiment")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeEntitySentiment")) - .build(); - } - } - } - return getAnalyzeEntitySentimentMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnalyzeSyntax", - requestType = com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest.class, - responseType = com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod; - if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) { - LanguageServiceGrpc.getAnalyzeSyntaxMethod = - getAnalyzeSyntaxMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSyntax")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnalyzeSyntax")) - .build(); - } - } - } - return getAnalyzeSyntaxMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse> - getClassifyTextMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ClassifyText", - requestType = com.google.cloud.language.v1beta2.ClassifyTextRequest.class, - responseType = com.google.cloud.language.v1beta2.ClassifyTextResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse> - getClassifyTextMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse> - getClassifyTextMethod; - if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) { - LanguageServiceGrpc.getClassifyTextMethod = - getClassifyTextMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ClassifyText")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.ClassifyTextRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.ClassifyTextResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("ClassifyText")) - .build(); - } - } - } - return getClassifyTextMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse> - getAnnotateTextMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "AnnotateText", - requestType = com.google.cloud.language.v1beta2.AnnotateTextRequest.class, - responseType = com.google.cloud.language.v1beta2.AnnotateTextResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse> - getAnnotateTextMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse> - getAnnotateTextMethod; - if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) { - synchronized (LanguageServiceGrpc.class) { - if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) { - LanguageServiceGrpc.getAnnotateTextMethod = - getAnnotateTextMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnnotateText")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnnotateTextRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.language.v1beta2.AnnotateTextResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new LanguageServiceMethodDescriptorSupplier("AnnotateText")) - .build(); - } - } - } - return getAnnotateTextMethod; - } - - /** Creates a new async stub that supports all call types for the service */ - public static LanguageServiceStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public LanguageServiceStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceStub(channel, callOptions); - } - }; - return LanguageServiceStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static LanguageServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public LanguageServiceBlockingStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceBlockingStub(channel, callOptions); - } - }; - return LanguageServiceBlockingStub.newStub(factory, channel); - } - - /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static LanguageServiceFutureStub newFutureStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public LanguageServiceFutureStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceFutureStub(channel, callOptions); - } - }; - return LanguageServiceFutureStub.newStub(factory, channel); - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public abstract static class LanguageServiceImplBase implements io.grpc.BindableService { - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public void analyzeSentiment( - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeSentimentMethod(), responseObserver); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public void analyzeEntities( - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeEntitiesMethod(), responseObserver); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public void analyzeEntitySentiment( - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest request, - io.grpc.stub.StreamObserver< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeEntitySentimentMethod(), responseObserver); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public void analyzeSyntax( - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnalyzeSyntaxMethod(), responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1beta2.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getClassifyTextMethod(), responseObserver); - } - - /** - * - * - *
-     * A convenience method that provides all syntax, sentiment, entity, and
-     * classification features in one call.
-     * 
- */ - public void annotateText( - com.google.cloud.language.v1beta2.AnnotateTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getAnnotateTextMethod(), responseObserver); - } - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getAnalyzeSentimentMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse>( - this, METHODID_ANALYZE_SENTIMENT))) - .addMethod( - getAnalyzeEntitiesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse>( - this, METHODID_ANALYZE_ENTITIES))) - .addMethod( - getAnalyzeEntitySentimentMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse>( - this, METHODID_ANALYZE_ENTITY_SENTIMENT))) - .addMethod( - getAnalyzeSyntaxMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse>( - this, METHODID_ANALYZE_SYNTAX))) - .addMethod( - getClassifyTextMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse>( - this, METHODID_CLASSIFY_TEXT))) - .addMethod( - getAnnotateTextMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse>( - this, METHODID_ANNOTATE_TEXT))) - .build(); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceStub - extends io.grpc.stub.AbstractAsyncStub { - private LanguageServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected LanguageServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceStub(channel, callOptions); - } - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public void analyzeSentiment( - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public void analyzeEntities( - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public void analyzeEntitySentiment( - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest request, - io.grpc.stub.StreamObserver< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public void analyzeSyntax( - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1beta2.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getClassifyTextMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * A convenience method that provides all syntax, sentiment, entity, and
-     * classification features in one call.
-     * 
- */ - public void annotateText( - com.google.cloud.language.v1beta2.AnnotateTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getAnnotateTextMethod(), getCallOptions()), - request, - responseObserver); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceBlockingStub - extends io.grpc.stub.AbstractBlockingStub { - private LanguageServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected LanguageServiceBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceBlockingStub(channel, callOptions); - } - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public com.google.cloud.language.v1beta2.AnalyzeSentimentResponse analyzeSentiment( - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeSentimentMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse analyzeEntities( - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeEntitiesMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse analyzeEntitySentiment( - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeEntitySentimentMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse analyzeSyntax( - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnalyzeSyntaxMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public com.google.cloud.language.v1beta2.ClassifyTextResponse classifyText( - com.google.cloud.language.v1beta2.ClassifyTextRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getClassifyTextMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * A convenience method that provides all syntax, sentiment, entity, and
-     * classification features in one call.
-     * 
- */ - public com.google.cloud.language.v1beta2.AnnotateTextResponse annotateText( - com.google.cloud.language.v1beta2.AnnotateTextRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getAnnotateTextMethod(), getCallOptions(), request); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceFutureStub - extends io.grpc.stub.AbstractFutureStub { - private LanguageServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected LanguageServiceFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new LanguageServiceFutureStub(channel, callOptions); - } - - /** - * - * - *
-     * Analyzes the sentiment of the provided text.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - analyzeSentiment(com.google.cloud.language.v1beta2.AnalyzeSentimentRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Finds named entities (currently proper names and common nouns) in the text
-     * along with entity types, salience, mentions for each entity, and
-     * other properties.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - analyzeEntities(com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities] in the text and analyzes
-     * sentiment associated with each entity and its mentions.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - analyzeEntitySentiment( - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Analyzes the syntax of the text and provides sentence boundaries and
-     * tokenization along with part of speech tags, dependency trees, and other
-     * properties.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - analyzeSyntax(com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1beta2.ClassifyTextResponse> - classifyText(com.google.cloud.language.v1beta2.ClassifyTextRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getClassifyTextMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * A convenience method that provides all syntax, sentiment, entity, and
-     * classification features in one call.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.language.v1beta2.AnnotateTextResponse> - annotateText(com.google.cloud.language.v1beta2.AnnotateTextRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getAnnotateTextMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_ANALYZE_SENTIMENT = 0; - private static final int METHODID_ANALYZE_ENTITIES = 1; - private static final int METHODID_ANALYZE_ENTITY_SENTIMENT = 2; - private static final int METHODID_ANALYZE_SYNTAX = 3; - private static final int METHODID_CLASSIFY_TEXT = 4; - private static final int METHODID_ANNOTATE_TEXT = 5; - - 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 LanguageServiceImplBase serviceImpl; - private final int methodId; - - MethodHandlers(LanguageServiceImplBase 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_ANALYZE_SENTIMENT: - serviceImpl.analyzeSentiment( - (com.google.cloud.language.v1beta2.AnalyzeSentimentRequest) request, - (io.grpc.stub.StreamObserver< - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse>) - responseObserver); - break; - case METHODID_ANALYZE_ENTITIES: - serviceImpl.analyzeEntities( - (com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest) request, - (io.grpc.stub.StreamObserver< - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse>) - responseObserver); - break; - case METHODID_ANALYZE_ENTITY_SENTIMENT: - serviceImpl.analyzeEntitySentiment( - (com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest) request, - (io.grpc.stub.StreamObserver< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse>) - responseObserver); - break; - case METHODID_ANALYZE_SYNTAX: - serviceImpl.analyzeSyntax( - (com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_CLASSIFY_TEXT: - serviceImpl.classifyText( - (com.google.cloud.language.v1beta2.ClassifyTextRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_ANNOTATE_TEXT: - serviceImpl.annotateText( - (com.google.cloud.language.v1beta2.AnnotateTextRequest) 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 LanguageServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, - io.grpc.protobuf.ProtoServiceDescriptorSupplier { - LanguageServiceBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.google.cloud.language.v1beta2.LanguageServiceProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("LanguageService"); - } - } - - private static final class LanguageServiceFileDescriptorSupplier - extends LanguageServiceBaseDescriptorSupplier { - LanguageServiceFileDescriptorSupplier() {} - } - - private static final class LanguageServiceMethodDescriptorSupplier - extends LanguageServiceBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - LanguageServiceMethodDescriptorSupplier(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 (LanguageServiceGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = - result = - io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new LanguageServiceFileDescriptorSupplier()) - .addMethod(getAnalyzeSentimentMethod()) - .addMethod(getAnalyzeEntitiesMethod()) - .addMethod(getAnalyzeEntitySentimentMethod()) - .addMethod(getAnalyzeSyntaxMethod()) - .addMethod(getClassifyTextMethod()) - .addMethod(getAnnotateTextMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/java.header b/java.header deleted file mode 100644 index d0970ba7..00000000 --- a/java.header +++ /dev/null @@ -1,15 +0,0 @@ -^/\*$ -^ \* Copyright \d\d\d\d,? Google (Inc\.|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\.$ -^ \*/$ diff --git a/license-checks.xml b/license-checks.xml deleted file mode 100644 index 6597fced..00000000 --- a/license-checks.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/pom.xml b/pom.xml deleted file mode 100644 index e80d5bca..00000000 --- a/pom.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-language-parent - pom - 2.4.2-SNAPSHOT - Google Cloud Natural Language Parent - https://github.com/googleapis/java-language - - Java idiomatic client for Google Cloud Platform services. - - - - com.google.cloud - google-cloud-shared-config - 1.5.4 - - - - - chingor - Jeff Ching - chingor@google.com - Google - - Developer - - - - - Google LLC - - - scm:git:git@github.com:googleapis/java-language.git - scm:git:git@github.com:googleapis/java-language.git - https://github.com/googleapis/java-language - HEAD - - - https://github.com/googleapis/java-language/issues - GitHub Issues - - - - - Apache-2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - - - - - UTF-8 - UTF-8 - github - google-cloud-language-parent - - - - - - com.google.api.grpc - proto-google-cloud-language-v1 - 2.4.2-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - 0.91.2-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-language-v1 - 2.4.2-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-language-v1beta2 - 0.91.2-SNAPSHOT - - - com.google.cloud - google-cloud-language - 2.4.2-SNAPSHOT - - - - com.google.cloud - google-cloud-shared-dependencies - 3.0.5 - pom - import - - - - junit - junit - 4.13.2 - test - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - org.objenesis:objenesis - javax.annotation:javax.annotation-api - - - - - - - - - google-cloud-language - grpc-google-cloud-language-v1 - grpc-google-cloud-language-v1beta2 - proto-google-cloud-language-v1 - proto-google-cloud-language-v1beta2 - google-cloud-language-bom - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.4.1 - - - - 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.4.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/ - - - - - - diff --git a/proto-google-cloud-language-v1/clirr-ignored-differences.xml b/proto-google-cloud-language-v1/clirr-ignored-differences.xml deleted file mode 100644 index 741654f7..00000000 --- a/proto-google-cloud-language-v1/clirr-ignored-differences.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 7012 - com/google/cloud/language/v1/*OrBuilder - * get*(*) - - - 7012 - com/google/cloud/language/v1/*OrBuilder - boolean contains*(*) - - - 7012 - com/google/cloud/language/v1/*OrBuilder - boolean has*(*) - - diff --git a/proto-google-cloud-language-v1/pom.xml b/proto-google-cloud-language-v1/pom.xml deleted file mode 100644 index ad72228f..00000000 --- a/proto-google-cloud-language-v1/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - com.google.api.grpc - proto-google-cloud-language-v1 - 2.4.2-SNAPSHOT - proto-google-cloud-language-v1 - PROTO library for proto-google-cloud-language-v1 - - com.google.cloud - google-cloud-language-parent - 2.4.2-SNAPSHOT - - - - com.google.protobuf - protobuf-java - - - com.google.api.grpc - proto-google-common-protos - - - - - - - org.codehaus.mojo - flatten-maven-plugin - - - - \ No newline at end of file diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java deleted file mode 100644 index 620d007a..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java +++ /dev/null @@ -1,877 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The entity analysis request message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitiesRequest} - */ -public final class AnalyzeEntitiesRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitiesRequest) - AnalyzeEntitiesRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeEntitiesRequest.newBuilder() to construct. - private AnalyzeEntitiesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeEntitiesRequest() { - encodingType_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeEntitiesRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitiesRequest.class, - com.google.cloud.language.v1.AnalyzeEntitiesRequest.Builder.class); - } - - public static final int DOCUMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Document document_; - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - @java.lang.Override - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - @java.lang.Override - public com.google.cloud.language.v1.Document getDocument() { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - return getDocument(); - } - - public static final int ENCODING_TYPE_FIELD_NUMBER = 2; - private int encodingType_; - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - - 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 (document_ != null) { - output.writeMessage(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - output.writeEnum(2, encodingType_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (document_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encodingType_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeEntitiesRequest)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeEntitiesRequest other = - (com.google.cloud.language.v1.AnalyzeEntitiesRequest) obj; - - if (hasDocument() != other.hasDocument()) return false; - if (hasDocument()) { - if (!getDocument().equals(other.getDocument())) return false; - } - if (encodingType_ != other.encodingType_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocument()) { - hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocument().hashCode(); - } - hash = (37 * hash) + ENCODING_TYPE_FIELD_NUMBER; - hash = (53 * hash) + encodingType_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest 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.language.v1.AnalyzeEntitiesRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest 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.language.v1.AnalyzeEntitiesRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest 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.language.v1.AnalyzeEntitiesRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest 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.language.v1.AnalyzeEntitiesRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest 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.language.v1.AnalyzeEntitiesRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The entity analysis request message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitiesRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeEntitiesRequest) - com.google.cloud.language.v1.AnalyzeEntitiesRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitiesRequest.class, - com.google.cloud.language.v1.AnalyzeEntitiesRequest.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeEntitiesRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentBuilder_ == null) { - document_ = null; - } else { - document_ = null; - documentBuilder_ = null; - } - encodingType_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesRequest getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeEntitiesRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesRequest build() { - com.google.cloud.language.v1.AnalyzeEntitiesRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesRequest buildPartial() { - com.google.cloud.language.v1.AnalyzeEntitiesRequest result = - new com.google.cloud.language.v1.AnalyzeEntitiesRequest(this); - if (documentBuilder_ == null) { - result.document_ = document_; - } else { - result.document_ = documentBuilder_.build(); - } - result.encodingType_ = encodingType_; - 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.language.v1.AnalyzeEntitiesRequest) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeEntitiesRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeEntitiesRequest other) { - if (other == com.google.cloud.language.v1.AnalyzeEntitiesRequest.getDefaultInstance()) - return this; - if (other.hasDocument()) { - mergeDocument(other.getDocument()); - } - if (other.encodingType_ != 0) { - setEncodingTypeValue(other.getEncodingTypeValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getDocumentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 16: - { - encodingType_ = input.readEnum(); - - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.language.v1.Document document_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - documentBuilder_; - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - public com.google.cloud.language.v1.Document getDocument() { - if (documentBuilder_ == null) { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } else { - return documentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - document_ = value; - onChanged(); - } else { - documentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document.Builder builderForValue) { - if (documentBuilder_ == null) { - document_ = builderForValue.build(); - onChanged(); - } else { - documentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (document_ != null) { - document_ = - com.google.cloud.language.v1.Document.newBuilder(document_) - .mergeFrom(value) - .buildPartial(); - } else { - document_ = value; - } - onChanged(); - } else { - documentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDocument() { - if (documentBuilder_ == null) { - document_ = null; - onChanged(); - } else { - document_ = null; - documentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { - - onChanged(); - return getDocumentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - if (documentBuilder_ != null) { - return documentBuilder_.getMessageOrBuilder(); - } else { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - getDocumentFieldBuilder() { - if (documentBuilder_ == null) { - documentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder>( - getDocument(), getParentForChildren(), isClean()); - document_ = null; - } - return documentBuilder_; - } - - private int encodingType_ = 0; - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The enum numeric value on the wire for encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingTypeValue(int value) { - - encodingType_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { - if (value == null) { - throw new NullPointerException(); - } - - encodingType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return This builder for chaining. - */ - public Builder clearEncodingType() { - - encodingType_ = 0; - 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.language.v1.AnalyzeEntitiesRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitiesRequest) - private static final com.google.cloud.language.v1.AnalyzeEntitiesRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitiesRequest(); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeEntitiesRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java deleted file mode 100644 index 2b0136d7..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeEntitiesRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitiesRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); - - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - com.google.cloud.language.v1.EncodingType getEncodingType(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java deleted file mode 100644 index 2b668265..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java +++ /dev/null @@ -1,1117 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The entity analysis response message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitiesResponse} - */ -public final class AnalyzeEntitiesResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitiesResponse) - AnalyzeEntitiesResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeEntitiesResponse.newBuilder() to construct. - private AnalyzeEntitiesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeEntitiesResponse() { - entities_ = java.util.Collections.emptyList(); - language_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeEntitiesResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitiesResponse.class, - com.google.cloud.language.v1.AnalyzeEntitiesResponse.Builder.class); - } - - public static final int ENTITIES_FIELD_NUMBER = 1; - private java.util.List entities_; - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public java.util.List getEntitiesList() { - return entities_; - } - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public java.util.List - getEntitiesOrBuilderList() { - return entities_; - } - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public int getEntitiesCount() { - return entities_.size(); - } - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.Entity getEntities(int index) { - return entities_.get(index); - } - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { - return entities_.get(index); - } - - public static final int LANGUAGE_FIELD_NUMBER = 2; - private volatile java.lang.Object language_; - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The language. - */ - @java.lang.Override - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - 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(); - language_ = s; - return s; - } - } - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - @java.lang.Override - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = 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 < entities_.size(); i++) { - output.writeMessage(1, entities_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < entities_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, entities_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeEntitiesResponse)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeEntitiesResponse other = - (com.google.cloud.language.v1.AnalyzeEntitiesResponse) obj; - - if (!getEntitiesList().equals(other.getEntitiesList())) return false; - if (!getLanguage().equals(other.getLanguage())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getEntitiesCount() > 0) { - hash = (37 * hash) + ENTITIES_FIELD_NUMBER; - hash = (53 * hash) + getEntitiesList().hashCode(); - } - hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; - hash = (53 * hash) + getLanguage().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse 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.language.v1.AnalyzeEntitiesResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse 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.language.v1.AnalyzeEntitiesResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse 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.language.v1.AnalyzeEntitiesResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse 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.language.v1.AnalyzeEntitiesResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse 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.language.v1.AnalyzeEntitiesResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The entity analysis response message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitiesResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeEntitiesResponse) - com.google.cloud.language.v1.AnalyzeEntitiesResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitiesResponse.class, - com.google.cloud.language.v1.AnalyzeEntitiesResponse.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeEntitiesResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - } else { - entities_ = null; - entitiesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - language_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesResponse getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeEntitiesResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesResponse build() { - com.google.cloud.language.v1.AnalyzeEntitiesResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesResponse buildPartial() { - com.google.cloud.language.v1.AnalyzeEntitiesResponse result = - new com.google.cloud.language.v1.AnalyzeEntitiesResponse(this); - int from_bitField0_ = bitField0_; - if (entitiesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - entities_ = java.util.Collections.unmodifiableList(entities_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.entities_ = entities_; - } else { - result.entities_ = entitiesBuilder_.build(); - } - result.language_ = language_; - 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.language.v1.AnalyzeEntitiesResponse) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeEntitiesResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeEntitiesResponse other) { - if (other == com.google.cloud.language.v1.AnalyzeEntitiesResponse.getDefaultInstance()) - return this; - if (entitiesBuilder_ == null) { - if (!other.entities_.isEmpty()) { - if (entities_.isEmpty()) { - entities_ = other.entities_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureEntitiesIsMutable(); - entities_.addAll(other.entities_); - } - onChanged(); - } - } else { - if (!other.entities_.isEmpty()) { - if (entitiesBuilder_.isEmpty()) { - entitiesBuilder_.dispose(); - entitiesBuilder_ = null; - entities_ = other.entities_; - bitField0_ = (bitField0_ & ~0x00000001); - entitiesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getEntitiesFieldBuilder() - : null; - } else { - entitiesBuilder_.addAllMessages(other.entities_); - } - } - } - if (!other.getLanguage().isEmpty()) { - language_ = other.language_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Entity m = - input.readMessage( - com.google.cloud.language.v1.Entity.parser(), extensionRegistry); - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(m); - } else { - entitiesBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - language_ = input.readStringRequireUtf8(); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List entities_ = - java.util.Collections.emptyList(); - - private void ensureEntitiesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - entities_ = new java.util.ArrayList(entities_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder> - entitiesBuilder_; - - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public java.util.List getEntitiesList() { - if (entitiesBuilder_ == null) { - return java.util.Collections.unmodifiableList(entities_); - } else { - return entitiesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public int getEntitiesCount() { - if (entitiesBuilder_ == null) { - return entities_.size(); - } else { - return entitiesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity getEntities(int index) { - if (entitiesBuilder_ == null) { - return entities_.get(index); - } else { - return entitiesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder setEntities(int index, com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.set(index, value); - onChanged(); - } else { - entitiesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder setEntities( - int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.set(index, builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities(com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.add(value); - onChanged(); - } else { - entitiesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities(int index, com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.add(index, value); - onChanged(); - } else { - entitiesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities(com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities( - int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(index, builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addAllEntities( - java.lang.Iterable values) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, entities_); - onChanged(); - } else { - entitiesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder clearEntities() { - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - entitiesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder removeEntities(int index) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.remove(index); - onChanged(); - } else { - entitiesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity.Builder getEntitiesBuilder(int index) { - return getEntitiesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { - if (entitiesBuilder_ == null) { - return entities_.get(index); - } else { - return entitiesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public java.util.List - getEntitiesOrBuilderList() { - if (entitiesBuilder_ != null) { - return entitiesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(entities_); - } - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder() { - return getEntitiesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Entity.getDefaultInstance()); - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder(int index) { - return getEntitiesFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Entity.getDefaultInstance()); - } - /** - * - * - *
-     * The recognized entities in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public java.util.List getEntitiesBuilderList() { - return getEntitiesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder> - getEntitiesFieldBuilder() { - if (entitiesBuilder_ == null) { - entitiesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder>( - entities_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - entities_ = null; - } - return entitiesBuilder_; - } - - private java.lang.Object language_ = ""; - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return The language. - */ - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - language_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @param value The language to set. - * @return This builder for chaining. - */ - public Builder setLanguage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - language_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return This builder for chaining. - */ - public Builder clearLanguage() { - - language_ = getDefaultInstance().getLanguage(); - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @param value The bytes for language to set. - * @return This builder for chaining. - */ - public Builder setLanguageBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - language_ = 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.language.v1.AnalyzeEntitiesResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitiesResponse) - private static final com.google.cloud.language.v1.AnalyzeEntitiesResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitiesResponse(); - } - - public static com.google.cloud.language.v1.AnalyzeEntitiesResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeEntitiesResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitiesResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java deleted file mode 100644 index 62bb035b..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeEntitiesResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitiesResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - java.util.List getEntitiesList(); - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - com.google.cloud.language.v1.Entity getEntities(int index); - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - int getEntitiesCount(); - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - java.util.List getEntitiesOrBuilderList(); - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index); - - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The language. - */ - java.lang.String getLanguage(); - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - com.google.protobuf.ByteString getLanguageBytes(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java deleted file mode 100644 index 7c2e7f06..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java +++ /dev/null @@ -1,878 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The entity-level sentiment analysis request message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitySentimentRequest} - */ -public final class AnalyzeEntitySentimentRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitySentimentRequest) - AnalyzeEntitySentimentRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeEntitySentimentRequest.newBuilder() to construct. - private AnalyzeEntitySentimentRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeEntitySentimentRequest() { - encodingType_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeEntitySentimentRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.class, - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.Builder.class); - } - - public static final int DOCUMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Document document_; - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - @java.lang.Override - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - @java.lang.Override - public com.google.cloud.language.v1.Document getDocument() { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - return getDocument(); - } - - public static final int ENCODING_TYPE_FIELD_NUMBER = 2; - private int encodingType_; - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - - 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 (document_ != null) { - output.writeMessage(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - output.writeEnum(2, encodingType_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (document_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encodingType_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeEntitySentimentRequest)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest other = - (com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) obj; - - if (hasDocument() != other.hasDocument()) return false; - if (hasDocument()) { - if (!getDocument().equals(other.getDocument())) return false; - } - if (encodingType_ != other.encodingType_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocument()) { - hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocument().hashCode(); - } - hash = (37 * hash) + ENCODING_TYPE_FIELD_NUMBER; - hash = (53 * hash) + encodingType_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest 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.language.v1.AnalyzeEntitySentimentRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest 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.language.v1.AnalyzeEntitySentimentRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest 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.language.v1.AnalyzeEntitySentimentRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest 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.language.v1.AnalyzeEntitySentimentRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest 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.language.v1.AnalyzeEntitySentimentRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The entity-level sentiment analysis request message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitySentimentRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeEntitySentimentRequest) - com.google.cloud.language.v1.AnalyzeEntitySentimentRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.class, - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentBuilder_ == null) { - document_ = null; - } else { - document_ = null; - documentBuilder_ = null; - } - encodingType_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentRequest getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentRequest build() { - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentRequest buildPartial() { - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest result = - new com.google.cloud.language.v1.AnalyzeEntitySentimentRequest(this); - if (documentBuilder_ == null) { - result.document_ = document_; - } else { - result.document_ = documentBuilder_.build(); - } - result.encodingType_ = encodingType_; - 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.language.v1.AnalyzeEntitySentimentRequest) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest other) { - if (other == com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.getDefaultInstance()) - return this; - if (other.hasDocument()) { - mergeDocument(other.getDocument()); - } - if (other.encodingType_ != 0) { - setEncodingTypeValue(other.getEncodingTypeValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getDocumentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 16: - { - encodingType_ = input.readEnum(); - - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.language.v1.Document document_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - documentBuilder_; - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - public com.google.cloud.language.v1.Document getDocument() { - if (documentBuilder_ == null) { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } else { - return documentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - document_ = value; - onChanged(); - } else { - documentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document.Builder builderForValue) { - if (documentBuilder_ == null) { - document_ = builderForValue.build(); - onChanged(); - } else { - documentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (document_ != null) { - document_ = - com.google.cloud.language.v1.Document.newBuilder(document_) - .mergeFrom(value) - .buildPartial(); - } else { - document_ = value; - } - onChanged(); - } else { - documentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDocument() { - if (documentBuilder_ == null) { - document_ = null; - onChanged(); - } else { - document_ = null; - documentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { - - onChanged(); - return getDocumentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - if (documentBuilder_ != null) { - return documentBuilder_.getMessageOrBuilder(); - } else { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - getDocumentFieldBuilder() { - if (documentBuilder_ == null) { - documentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder>( - getDocument(), getParentForChildren(), isClean()); - document_ = null; - } - return documentBuilder_; - } - - private int encodingType_ = 0; - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The enum numeric value on the wire for encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingTypeValue(int value) { - - encodingType_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { - if (value == null) { - throw new NullPointerException(); - } - - encodingType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return This builder for chaining. - */ - public Builder clearEncodingType() { - - encodingType_ = 0; - 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.language.v1.AnalyzeEntitySentimentRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitySentimentRequest) - private static final com.google.cloud.language.v1.AnalyzeEntitySentimentRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitySentimentRequest(); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeEntitySentimentRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java deleted file mode 100644 index 9001f8b5..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeEntitySentimentRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitySentimentRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); - - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - com.google.cloud.language.v1.EncodingType getEncodingType(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java deleted file mode 100644 index 70859072..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java +++ /dev/null @@ -1,1119 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The entity-level sentiment analysis response message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitySentimentResponse} - */ -public final class AnalyzeEntitySentimentResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitySentimentResponse) - AnalyzeEntitySentimentResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeEntitySentimentResponse.newBuilder() to construct. - private AnalyzeEntitySentimentResponse( - com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeEntitySentimentResponse() { - entities_ = java.util.Collections.emptyList(); - language_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeEntitySentimentResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.class, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.Builder.class); - } - - public static final int ENTITIES_FIELD_NUMBER = 1; - private java.util.List entities_; - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public java.util.List getEntitiesList() { - return entities_; - } - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public java.util.List - getEntitiesOrBuilderList() { - return entities_; - } - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public int getEntitiesCount() { - return entities_.size(); - } - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.Entity getEntities(int index) { - return entities_.get(index); - } - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { - return entities_.get(index); - } - - public static final int LANGUAGE_FIELD_NUMBER = 2; - private volatile java.lang.Object language_; - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The language. - */ - @java.lang.Override - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - 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(); - language_ = s; - return s; - } - } - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - @java.lang.Override - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = 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 < entities_.size(); i++) { - output.writeMessage(1, entities_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < entities_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, entities_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeEntitySentimentResponse)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse other = - (com.google.cloud.language.v1.AnalyzeEntitySentimentResponse) obj; - - if (!getEntitiesList().equals(other.getEntitiesList())) return false; - if (!getLanguage().equals(other.getLanguage())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getEntitiesCount() > 0) { - hash = (37 * hash) + ENTITIES_FIELD_NUMBER; - hash = (53 * hash) + getEntitiesList().hashCode(); - } - hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; - hash = (53 * hash) + getLanguage().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse 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.language.v1.AnalyzeEntitySentimentResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse 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.language.v1.AnalyzeEntitySentimentResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse 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.language.v1.AnalyzeEntitySentimentResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse 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.language.v1.AnalyzeEntitySentimentResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse 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.language.v1.AnalyzeEntitySentimentResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The entity-level sentiment analysis response message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitySentimentResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeEntitySentimentResponse) - com.google.cloud.language.v1.AnalyzeEntitySentimentResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.class, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - } else { - entities_ = null; - entitiesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - language_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse build() { - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse buildPartial() { - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse result = - new com.google.cloud.language.v1.AnalyzeEntitySentimentResponse(this); - int from_bitField0_ = bitField0_; - if (entitiesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - entities_ = java.util.Collections.unmodifiableList(entities_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.entities_ = entities_; - } else { - result.entities_ = entitiesBuilder_.build(); - } - result.language_ = language_; - 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.language.v1.AnalyzeEntitySentimentResponse) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeEntitySentimentResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeEntitySentimentResponse other) { - if (other == com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.getDefaultInstance()) - return this; - if (entitiesBuilder_ == null) { - if (!other.entities_.isEmpty()) { - if (entities_.isEmpty()) { - entities_ = other.entities_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureEntitiesIsMutable(); - entities_.addAll(other.entities_); - } - onChanged(); - } - } else { - if (!other.entities_.isEmpty()) { - if (entitiesBuilder_.isEmpty()) { - entitiesBuilder_.dispose(); - entitiesBuilder_ = null; - entities_ = other.entities_; - bitField0_ = (bitField0_ & ~0x00000001); - entitiesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getEntitiesFieldBuilder() - : null; - } else { - entitiesBuilder_.addAllMessages(other.entities_); - } - } - } - if (!other.getLanguage().isEmpty()) { - language_ = other.language_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Entity m = - input.readMessage( - com.google.cloud.language.v1.Entity.parser(), extensionRegistry); - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(m); - } else { - entitiesBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - language_ = input.readStringRequireUtf8(); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List entities_ = - java.util.Collections.emptyList(); - - private void ensureEntitiesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - entities_ = new java.util.ArrayList(entities_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder> - entitiesBuilder_; - - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public java.util.List getEntitiesList() { - if (entitiesBuilder_ == null) { - return java.util.Collections.unmodifiableList(entities_); - } else { - return entitiesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public int getEntitiesCount() { - if (entitiesBuilder_ == null) { - return entities_.size(); - } else { - return entitiesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity getEntities(int index) { - if (entitiesBuilder_ == null) { - return entities_.get(index); - } else { - return entitiesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder setEntities(int index, com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.set(index, value); - onChanged(); - } else { - entitiesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder setEntities( - int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.set(index, builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities(com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.add(value); - onChanged(); - } else { - entitiesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities(int index, com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.add(index, value); - onChanged(); - } else { - entitiesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities(com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addEntities( - int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(index, builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder addAllEntities( - java.lang.Iterable values) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, entities_); - onChanged(); - } else { - entitiesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder clearEntities() { - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - entitiesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public Builder removeEntities(int index) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.remove(index); - onChanged(); - } else { - entitiesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity.Builder getEntitiesBuilder(int index) { - return getEntitiesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { - if (entitiesBuilder_ == null) { - return entities_.get(index); - } else { - return entitiesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public java.util.List - getEntitiesOrBuilderList() { - if (entitiesBuilder_ != null) { - return entitiesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(entities_); - } - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder() { - return getEntitiesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Entity.getDefaultInstance()); - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder(int index) { - return getEntitiesFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Entity.getDefaultInstance()); - } - /** - * - * - *
-     * The recognized entities in the input document with associated sentiments.
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public java.util.List getEntitiesBuilderList() { - return getEntitiesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder> - getEntitiesFieldBuilder() { - if (entitiesBuilder_ == null) { - entitiesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder>( - entities_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - entities_ = null; - } - return entitiesBuilder_; - } - - private java.lang.Object language_ = ""; - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return The language. - */ - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - language_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @param value The language to set. - * @return This builder for chaining. - */ - public Builder setLanguage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - language_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return This builder for chaining. - */ - public Builder clearLanguage() { - - language_ = getDefaultInstance().getLanguage(); - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @param value The bytes for language to set. - * @return This builder for chaining. - */ - public Builder setLanguageBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - language_ = 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.language.v1.AnalyzeEntitySentimentResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitySentimentResponse) - private static final com.google.cloud.language.v1.AnalyzeEntitySentimentResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitySentimentResponse(); - } - - public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeEntitySentimentResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java deleted file mode 100644 index 16ee973a..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeEntitySentimentResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitySentimentResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - java.util.List getEntitiesList(); - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - com.google.cloud.language.v1.Entity getEntities(int index); - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - int getEntitiesCount(); - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - java.util.List getEntitiesOrBuilderList(); - /** - * - * - *
-   * The recognized entities in the input document with associated sentiments.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index); - - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The language. - */ - java.lang.String getLanguage(); - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - com.google.protobuf.ByteString getLanguageBytes(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java deleted file mode 100644 index f3a5f9f7..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java +++ /dev/null @@ -1,877 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The sentiment analysis request message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentRequest} - */ -public final class AnalyzeSentimentRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSentimentRequest) - AnalyzeSentimentRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeSentimentRequest.newBuilder() to construct. - private AnalyzeSentimentRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeSentimentRequest() { - encodingType_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeSentimentRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSentimentRequest.class, - com.google.cloud.language.v1.AnalyzeSentimentRequest.Builder.class); - } - - public static final int DOCUMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Document document_; - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - @java.lang.Override - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - @java.lang.Override - public com.google.cloud.language.v1.Document getDocument() { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - return getDocument(); - } - - public static final int ENCODING_TYPE_FIELD_NUMBER = 2; - private int encodingType_; - /** - * - * - *
-   * The encoding type used by the API to calculate sentence offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate sentence offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - - 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 (document_ != null) { - output.writeMessage(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - output.writeEnum(2, encodingType_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (document_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encodingType_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSentimentRequest)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeSentimentRequest other = - (com.google.cloud.language.v1.AnalyzeSentimentRequest) obj; - - if (hasDocument() != other.hasDocument()) return false; - if (hasDocument()) { - if (!getDocument().equals(other.getDocument())) return false; - } - if (encodingType_ != other.encodingType_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocument()) { - hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocument().hashCode(); - } - hash = (37 * hash) + ENCODING_TYPE_FIELD_NUMBER; - hash = (53 * hash) + encodingType_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest 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.language.v1.AnalyzeSentimentRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest 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.language.v1.AnalyzeSentimentRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest 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.language.v1.AnalyzeSentimentRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest 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.language.v1.AnalyzeSentimentRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest 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.language.v1.AnalyzeSentimentRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The sentiment analysis request message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeSentimentRequest) - com.google.cloud.language.v1.AnalyzeSentimentRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSentimentRequest.class, - com.google.cloud.language.v1.AnalyzeSentimentRequest.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeSentimentRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentBuilder_ == null) { - document_ = null; - } else { - document_ = null; - documentBuilder_ = null; - } - encodingType_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentRequest getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeSentimentRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentRequest build() { - com.google.cloud.language.v1.AnalyzeSentimentRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentRequest buildPartial() { - com.google.cloud.language.v1.AnalyzeSentimentRequest result = - new com.google.cloud.language.v1.AnalyzeSentimentRequest(this); - if (documentBuilder_ == null) { - result.document_ = document_; - } else { - result.document_ = documentBuilder_.build(); - } - result.encodingType_ = encodingType_; - 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.language.v1.AnalyzeSentimentRequest) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeSentimentRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSentimentRequest other) { - if (other == com.google.cloud.language.v1.AnalyzeSentimentRequest.getDefaultInstance()) - return this; - if (other.hasDocument()) { - mergeDocument(other.getDocument()); - } - if (other.encodingType_ != 0) { - setEncodingTypeValue(other.getEncodingTypeValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getDocumentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 16: - { - encodingType_ = input.readEnum(); - - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.language.v1.Document document_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - documentBuilder_; - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - public com.google.cloud.language.v1.Document getDocument() { - if (documentBuilder_ == null) { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } else { - return documentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - document_ = value; - onChanged(); - } else { - documentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document.Builder builderForValue) { - if (documentBuilder_ == null) { - document_ = builderForValue.build(); - onChanged(); - } else { - documentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (document_ != null) { - document_ = - com.google.cloud.language.v1.Document.newBuilder(document_) - .mergeFrom(value) - .buildPartial(); - } else { - document_ = value; - } - onChanged(); - } else { - documentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDocument() { - if (documentBuilder_ == null) { - document_ = null; - onChanged(); - } else { - document_ = null; - documentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { - - onChanged(); - return getDocumentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - if (documentBuilder_ != null) { - return documentBuilder_.getMessageOrBuilder(); - } else { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - getDocumentFieldBuilder() { - if (documentBuilder_ == null) { - documentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder>( - getDocument(), getParentForChildren(), isClean()); - document_ = null; - } - return documentBuilder_; - } - - private int encodingType_ = 0; - /** - * - * - *
-     * The encoding type used by the API to calculate sentence offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate sentence offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The enum numeric value on the wire for encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingTypeValue(int value) { - - encodingType_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate sentence offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - /** - * - * - *
-     * The encoding type used by the API to calculate sentence offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { - if (value == null) { - throw new NullPointerException(); - } - - encodingType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate sentence offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return This builder for chaining. - */ - public Builder clearEncodingType() { - - encodingType_ = 0; - 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.language.v1.AnalyzeSentimentRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSentimentRequest) - private static final com.google.cloud.language.v1.AnalyzeSentimentRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSentimentRequest(); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeSentimentRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java deleted file mode 100644 index 10852b5c..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeSentimentRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSentimentRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); - - /** - * - * - *
-   * The encoding type used by the API to calculate sentence offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate sentence offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - com.google.cloud.language.v1.EncodingType getEncodingType(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java deleted file mode 100644 index be629c99..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java +++ /dev/null @@ -1,1387 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The sentiment analysis response message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentResponse} - */ -public final class AnalyzeSentimentResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSentimentResponse) - AnalyzeSentimentResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeSentimentResponse.newBuilder() to construct. - private AnalyzeSentimentResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeSentimentResponse() { - language_ = ""; - sentences_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeSentimentResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSentimentResponse.class, - com.google.cloud.language.v1.AnalyzeSentimentResponse.Builder.class); - } - - public static final int DOCUMENT_SENTIMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Sentiment documentSentiment_; - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - * - * @return Whether the documentSentiment field is set. - */ - @java.lang.Override - public boolean hasDocumentSentiment() { - return documentSentiment_ != null; - } - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - * - * @return The documentSentiment. - */ - @java.lang.Override - public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { - return documentSentiment_ == null - ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() - : documentSentiment_; - } - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { - return getDocumentSentiment(); - } - - public static final int LANGUAGE_FIELD_NUMBER = 2; - private volatile java.lang.Object language_; - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The language. - */ - @java.lang.Override - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - 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(); - language_ = s; - return s; - } - } - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - @java.lang.Override - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SENTENCES_FIELD_NUMBER = 3; - private java.util.List sentences_; - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - @java.lang.Override - public java.util.List getSentencesList() { - return sentences_; - } - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - @java.lang.Override - public java.util.List - getSentencesOrBuilderList() { - return sentences_; - } - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - @java.lang.Override - public int getSentencesCount() { - return sentences_.size(); - } - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - @java.lang.Override - public com.google.cloud.language.v1.Sentence getSentences(int index) { - return sentences_.get(index); - } - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - @java.lang.Override - public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { - return sentences_.get(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (documentSentiment_ != null) { - output.writeMessage(1, getDocumentSentiment()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_); - } - for (int i = 0; i < sentences_.size(); i++) { - output.writeMessage(3, sentences_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (documentSentiment_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocumentSentiment()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); - } - for (int i = 0; i < sentences_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, sentences_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSentimentResponse)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeSentimentResponse other = - (com.google.cloud.language.v1.AnalyzeSentimentResponse) obj; - - if (hasDocumentSentiment() != other.hasDocumentSentiment()) return false; - if (hasDocumentSentiment()) { - if (!getDocumentSentiment().equals(other.getDocumentSentiment())) return false; - } - if (!getLanguage().equals(other.getLanguage())) return false; - if (!getSentencesList().equals(other.getSentencesList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocumentSentiment()) { - hash = (37 * hash) + DOCUMENT_SENTIMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocumentSentiment().hashCode(); - } - hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; - hash = (53 * hash) + getLanguage().hashCode(); - if (getSentencesCount() > 0) { - hash = (37 * hash) + SENTENCES_FIELD_NUMBER; - hash = (53 * hash) + getSentencesList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse 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.language.v1.AnalyzeSentimentResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse 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.language.v1.AnalyzeSentimentResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse 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.language.v1.AnalyzeSentimentResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse 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.language.v1.AnalyzeSentimentResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse 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.language.v1.AnalyzeSentimentResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The sentiment analysis response message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeSentimentResponse) - com.google.cloud.language.v1.AnalyzeSentimentResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSentimentResponse.class, - com.google.cloud.language.v1.AnalyzeSentimentResponse.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeSentimentResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentSentimentBuilder_ == null) { - documentSentiment_ = null; - } else { - documentSentiment_ = null; - documentSentimentBuilder_ = null; - } - language_ = ""; - - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - } else { - sentences_ = null; - sentencesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeSentimentResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentResponse build() { - com.google.cloud.language.v1.AnalyzeSentimentResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentResponse buildPartial() { - com.google.cloud.language.v1.AnalyzeSentimentResponse result = - new com.google.cloud.language.v1.AnalyzeSentimentResponse(this); - int from_bitField0_ = bitField0_; - if (documentSentimentBuilder_ == null) { - result.documentSentiment_ = documentSentiment_; - } else { - result.documentSentiment_ = documentSentimentBuilder_.build(); - } - result.language_ = language_; - if (sentencesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - sentences_ = java.util.Collections.unmodifiableList(sentences_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.sentences_ = sentences_; - } else { - result.sentences_ = sentencesBuilder_.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.language.v1.AnalyzeSentimentResponse) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeSentimentResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSentimentResponse other) { - if (other == com.google.cloud.language.v1.AnalyzeSentimentResponse.getDefaultInstance()) - return this; - if (other.hasDocumentSentiment()) { - mergeDocumentSentiment(other.getDocumentSentiment()); - } - if (!other.getLanguage().isEmpty()) { - language_ = other.language_; - onChanged(); - } - if (sentencesBuilder_ == null) { - if (!other.sentences_.isEmpty()) { - if (sentences_.isEmpty()) { - sentences_ = other.sentences_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureSentencesIsMutable(); - sentences_.addAll(other.sentences_); - } - onChanged(); - } - } else { - if (!other.sentences_.isEmpty()) { - if (sentencesBuilder_.isEmpty()) { - sentencesBuilder_.dispose(); - sentencesBuilder_ = null; - sentences_ = other.sentences_; - bitField0_ = (bitField0_ & ~0x00000001); - sentencesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getSentencesFieldBuilder() - : null; - } else { - sentencesBuilder_.addAllMessages(other.sentences_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage( - getDocumentSentimentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 18: - { - language_ = input.readStringRequireUtf8(); - - break; - } // case 18 - case 26: - { - com.google.cloud.language.v1.Sentence m = - input.readMessage( - com.google.cloud.language.v1.Sentence.parser(), extensionRegistry); - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(m); - } else { - sentencesBuilder_.addMessage(m); - } - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private com.google.cloud.language.v1.Sentiment documentSentiment_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Sentiment, - com.google.cloud.language.v1.Sentiment.Builder, - com.google.cloud.language.v1.SentimentOrBuilder> - documentSentimentBuilder_; - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - * - * @return Whether the documentSentiment field is set. - */ - public boolean hasDocumentSentiment() { - return documentSentimentBuilder_ != null || documentSentiment_ != null; - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - * - * @return The documentSentiment. - */ - public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { - if (documentSentimentBuilder_ == null) { - return documentSentiment_ == null - ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() - : documentSentiment_; - } else { - return documentSentimentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - public Builder setDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { - if (documentSentimentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - documentSentiment_ = value; - onChanged(); - } else { - documentSentimentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - public Builder setDocumentSentiment( - com.google.cloud.language.v1.Sentiment.Builder builderForValue) { - if (documentSentimentBuilder_ == null) { - documentSentiment_ = builderForValue.build(); - onChanged(); - } else { - documentSentimentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - public Builder mergeDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { - if (documentSentimentBuilder_ == null) { - if (documentSentiment_ != null) { - documentSentiment_ = - com.google.cloud.language.v1.Sentiment.newBuilder(documentSentiment_) - .mergeFrom(value) - .buildPartial(); - } else { - documentSentiment_ = value; - } - onChanged(); - } else { - documentSentimentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - public Builder clearDocumentSentiment() { - if (documentSentimentBuilder_ == null) { - documentSentiment_ = null; - onChanged(); - } else { - documentSentiment_ = null; - documentSentimentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - public com.google.cloud.language.v1.Sentiment.Builder getDocumentSentimentBuilder() { - - onChanged(); - return getDocumentSentimentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { - if (documentSentimentBuilder_ != null) { - return documentSentimentBuilder_.getMessageOrBuilder(); - } else { - return documentSentiment_ == null - ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() - : documentSentiment_; - } - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Sentiment, - com.google.cloud.language.v1.Sentiment.Builder, - com.google.cloud.language.v1.SentimentOrBuilder> - getDocumentSentimentFieldBuilder() { - if (documentSentimentBuilder_ == null) { - documentSentimentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Sentiment, - com.google.cloud.language.v1.Sentiment.Builder, - com.google.cloud.language.v1.SentimentOrBuilder>( - getDocumentSentiment(), getParentForChildren(), isClean()); - documentSentiment_ = null; - } - return documentSentimentBuilder_; - } - - private java.lang.Object language_ = ""; - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return The language. - */ - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - language_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @param value The language to set. - * @return This builder for chaining. - */ - public Builder setLanguage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - language_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @return This builder for chaining. - */ - public Builder clearLanguage() { - - language_ = getDefaultInstance().getLanguage(); - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 2; - * - * @param value The bytes for language to set. - * @return This builder for chaining. - */ - public Builder setLanguageBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - language_ = value; - onChanged(); - return this; - } - - private java.util.List sentences_ = - java.util.Collections.emptyList(); - - private void ensureSentencesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - sentences_ = new java.util.ArrayList(sentences_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder> - sentencesBuilder_; - - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public java.util.List getSentencesList() { - if (sentencesBuilder_ == null) { - return java.util.Collections.unmodifiableList(sentences_); - } else { - return sentencesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public int getSentencesCount() { - if (sentencesBuilder_ == null) { - return sentences_.size(); - } else { - return sentencesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public com.google.cloud.language.v1.Sentence getSentences(int index) { - if (sentencesBuilder_ == null) { - return sentences_.get(index); - } else { - return sentencesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder setSentences(int index, com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.set(index, value); - onChanged(); - } else { - sentencesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder setSentences( - int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.set(index, builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder addSentences(com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.add(value); - onChanged(); - } else { - sentencesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder addSentences(int index, com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.add(index, value); - onChanged(); - } else { - sentencesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder addSentences(com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder addSentences( - int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(index, builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder addAllSentences( - java.lang.Iterable values) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, sentences_); - onChanged(); - } else { - sentencesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder clearSentences() { - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - sentencesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public Builder removeSentences(int index) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.remove(index); - onChanged(); - } else { - sentencesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder(int index) { - return getSentencesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { - if (sentencesBuilder_ == null) { - return sentences_.get(index); - } else { - return sentencesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public java.util.List - getSentencesOrBuilderList() { - if (sentencesBuilder_ != null) { - return sentencesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(sentences_); - } - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() { - return getSentencesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Sentence.getDefaultInstance()); - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder(int index) { - return getSentencesFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Sentence.getDefaultInstance()); - } - /** - * - * - *
-     * The sentiment for all the sentences in the document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public java.util.List getSentencesBuilderList() { - return getSentencesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder> - getSentencesFieldBuilder() { - if (sentencesBuilder_ == null) { - sentencesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder>( - sentences_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - sentences_ = null; - } - return sentencesBuilder_; - } - - @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.language.v1.AnalyzeSentimentResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSentimentResponse) - private static final com.google.cloud.language.v1.AnalyzeSentimentResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSentimentResponse(); - } - - public static com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeSentimentResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java deleted file mode 100644 index 9fa9e608..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeSentimentResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSentimentResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - * - * @return Whether the documentSentiment field is set. - */ - boolean hasDocumentSentiment(); - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - * - * @return The documentSentiment. - */ - com.google.cloud.language.v1.Sentiment getDocumentSentiment(); - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder(); - - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The language. - */ - java.lang.String getLanguage(); - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 2; - * - * @return The bytes for language. - */ - com.google.protobuf.ByteString getLanguageBytes(); - - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - java.util.List getSentencesList(); - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - com.google.cloud.language.v1.Sentence getSentences(int index); - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - int getSentencesCount(); - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - java.util.List - getSentencesOrBuilderList(); - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java deleted file mode 100644 index e5cd33bb..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java +++ /dev/null @@ -1,877 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The syntax analysis request message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSyntaxRequest} - */ -public final class AnalyzeSyntaxRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSyntaxRequest) - AnalyzeSyntaxRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeSyntaxRequest.newBuilder() to construct. - private AnalyzeSyntaxRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeSyntaxRequest() { - encodingType_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeSyntaxRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSyntaxRequest.class, - com.google.cloud.language.v1.AnalyzeSyntaxRequest.Builder.class); - } - - public static final int DOCUMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Document document_; - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - @java.lang.Override - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - @java.lang.Override - public com.google.cloud.language.v1.Document getDocument() { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - return getDocument(); - } - - public static final int ENCODING_TYPE_FIELD_NUMBER = 2; - private int encodingType_; - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - - 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 (document_ != null) { - output.writeMessage(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - output.writeEnum(2, encodingType_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (document_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, encodingType_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSyntaxRequest)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeSyntaxRequest other = - (com.google.cloud.language.v1.AnalyzeSyntaxRequest) obj; - - if (hasDocument() != other.hasDocument()) return false; - if (hasDocument()) { - if (!getDocument().equals(other.getDocument())) return false; - } - if (encodingType_ != other.encodingType_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocument()) { - hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocument().hashCode(); - } - hash = (37 * hash) + ENCODING_TYPE_FIELD_NUMBER; - hash = (53 * hash) + encodingType_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest 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.language.v1.AnalyzeSyntaxRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest 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.language.v1.AnalyzeSyntaxRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest 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.language.v1.AnalyzeSyntaxRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest 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.language.v1.AnalyzeSyntaxRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest 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.language.v1.AnalyzeSyntaxRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The syntax analysis request message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSyntaxRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeSyntaxRequest) - com.google.cloud.language.v1.AnalyzeSyntaxRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSyntaxRequest.class, - com.google.cloud.language.v1.AnalyzeSyntaxRequest.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeSyntaxRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentBuilder_ == null) { - document_ = null; - } else { - document_ = null; - documentBuilder_ = null; - } - encodingType_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxRequest getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeSyntaxRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxRequest build() { - com.google.cloud.language.v1.AnalyzeSyntaxRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxRequest buildPartial() { - com.google.cloud.language.v1.AnalyzeSyntaxRequest result = - new com.google.cloud.language.v1.AnalyzeSyntaxRequest(this); - if (documentBuilder_ == null) { - result.document_ = document_; - } else { - result.document_ = documentBuilder_.build(); - } - result.encodingType_ = encodingType_; - 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.language.v1.AnalyzeSyntaxRequest) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeSyntaxRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSyntaxRequest other) { - if (other == com.google.cloud.language.v1.AnalyzeSyntaxRequest.getDefaultInstance()) - return this; - if (other.hasDocument()) { - mergeDocument(other.getDocument()); - } - if (other.encodingType_ != 0) { - setEncodingTypeValue(other.getEncodingTypeValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getDocumentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 16: - { - encodingType_ = input.readEnum(); - - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.language.v1.Document document_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - documentBuilder_; - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - public com.google.cloud.language.v1.Document getDocument() { - if (documentBuilder_ == null) { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } else { - return documentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - document_ = value; - onChanged(); - } else { - documentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document.Builder builderForValue) { - if (documentBuilder_ == null) { - document_ = builderForValue.build(); - onChanged(); - } else { - documentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (document_ != null) { - document_ = - com.google.cloud.language.v1.Document.newBuilder(document_) - .mergeFrom(value) - .buildPartial(); - } else { - document_ = value; - } - onChanged(); - } else { - documentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDocument() { - if (documentBuilder_ == null) { - document_ = null; - onChanged(); - } else { - document_ = null; - documentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { - - onChanged(); - return getDocumentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - if (documentBuilder_ != null) { - return documentBuilder_.getMessageOrBuilder(); - } else { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - getDocumentFieldBuilder() { - if (documentBuilder_ == null) { - documentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder>( - getDocument(), getParentForChildren(), isClean()); - document_ = null; - } - return documentBuilder_; - } - - private int encodingType_ = 0; - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The enum numeric value on the wire for encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingTypeValue(int value) { - - encodingType_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @param value The encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { - if (value == null) { - throw new NullPointerException(); - } - - encodingType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return This builder for chaining. - */ - public Builder clearEncodingType() { - - encodingType_ = 0; - 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.language.v1.AnalyzeSyntaxRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSyntaxRequest) - private static final com.google.cloud.language.v1.AnalyzeSyntaxRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSyntaxRequest(); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeSyntaxRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java deleted file mode 100644 index 346123c3..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeSyntaxRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSyntaxRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); - - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The enum numeric value on the wire for encodingType. - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - * - * @return The encodingType. - */ - com.google.cloud.language.v1.EncodingType getEncodingType(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java deleted file mode 100644 index 5d833f08..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java +++ /dev/null @@ -1,1602 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The syntax analysis response message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSyntaxResponse} - */ -public final class AnalyzeSyntaxResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSyntaxResponse) - AnalyzeSyntaxResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnalyzeSyntaxResponse.newBuilder() to construct. - private AnalyzeSyntaxResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnalyzeSyntaxResponse() { - sentences_ = java.util.Collections.emptyList(); - tokens_ = java.util.Collections.emptyList(); - language_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnalyzeSyntaxResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSyntaxResponse.class, - com.google.cloud.language.v1.AnalyzeSyntaxResponse.Builder.class); - } - - public static final int SENTENCES_FIELD_NUMBER = 1; - private java.util.List sentences_; - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public java.util.List getSentencesList() { - return sentences_; - } - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public java.util.List - getSentencesOrBuilderList() { - return sentences_; - } - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public int getSentencesCount() { - return sentences_.size(); - } - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.Sentence getSentences(int index) { - return sentences_.get(index); - } - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { - return sentences_.get(index); - } - - public static final int TOKENS_FIELD_NUMBER = 2; - private java.util.List tokens_; - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public java.util.List getTokensList() { - return tokens_; - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public java.util.List - getTokensOrBuilderList() { - return tokens_; - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public int getTokensCount() { - return tokens_.size(); - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public com.google.cloud.language.v1.Token getTokens(int index) { - return tokens_.get(index); - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index) { - return tokens_.get(index); - } - - public static final int LANGUAGE_FIELD_NUMBER = 3; - private volatile java.lang.Object language_; - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 3; - * - * @return The language. - */ - @java.lang.Override - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - 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(); - language_ = s; - return s; - } - } - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 3; - * - * @return The bytes for language. - */ - @java.lang.Override - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = 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 < sentences_.size(); i++) { - output.writeMessage(1, sentences_.get(i)); - } - for (int i = 0; i < tokens_.size(); i++) { - output.writeMessage(2, tokens_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, language_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < sentences_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, sentences_.get(i)); - } - for (int i = 0; i < tokens_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, tokens_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, language_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSyntaxResponse)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnalyzeSyntaxResponse other = - (com.google.cloud.language.v1.AnalyzeSyntaxResponse) obj; - - if (!getSentencesList().equals(other.getSentencesList())) return false; - if (!getTokensList().equals(other.getTokensList())) return false; - if (!getLanguage().equals(other.getLanguage())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getSentencesCount() > 0) { - hash = (37 * hash) + SENTENCES_FIELD_NUMBER; - hash = (53 * hash) + getSentencesList().hashCode(); - } - if (getTokensCount() > 0) { - hash = (37 * hash) + TOKENS_FIELD_NUMBER; - hash = (53 * hash) + getTokensList().hashCode(); - } - hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; - hash = (53 * hash) + getLanguage().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse 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.language.v1.AnalyzeSyntaxResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse 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.language.v1.AnalyzeSyntaxResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse 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.language.v1.AnalyzeSyntaxResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse 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.language.v1.AnalyzeSyntaxResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse 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.language.v1.AnalyzeSyntaxResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The syntax analysis response message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnalyzeSyntaxResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeSyntaxResponse) - com.google.cloud.language.v1.AnalyzeSyntaxResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnalyzeSyntaxResponse.class, - com.google.cloud.language.v1.AnalyzeSyntaxResponse.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnalyzeSyntaxResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - } else { - sentences_ = null; - sentencesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (tokensBuilder_ == null) { - tokens_ = java.util.Collections.emptyList(); - } else { - tokens_ = null; - tokensBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - language_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxResponse getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnalyzeSyntaxResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxResponse build() { - com.google.cloud.language.v1.AnalyzeSyntaxResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxResponse buildPartial() { - com.google.cloud.language.v1.AnalyzeSyntaxResponse result = - new com.google.cloud.language.v1.AnalyzeSyntaxResponse(this); - int from_bitField0_ = bitField0_; - if (sentencesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - sentences_ = java.util.Collections.unmodifiableList(sentences_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.sentences_ = sentences_; - } else { - result.sentences_ = sentencesBuilder_.build(); - } - if (tokensBuilder_ == null) { - if (((bitField0_ & 0x00000002) != 0)) { - tokens_ = java.util.Collections.unmodifiableList(tokens_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.tokens_ = tokens_; - } else { - result.tokens_ = tokensBuilder_.build(); - } - result.language_ = language_; - 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.language.v1.AnalyzeSyntaxResponse) { - return mergeFrom((com.google.cloud.language.v1.AnalyzeSyntaxResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSyntaxResponse other) { - if (other == com.google.cloud.language.v1.AnalyzeSyntaxResponse.getDefaultInstance()) - return this; - if (sentencesBuilder_ == null) { - if (!other.sentences_.isEmpty()) { - if (sentences_.isEmpty()) { - sentences_ = other.sentences_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureSentencesIsMutable(); - sentences_.addAll(other.sentences_); - } - onChanged(); - } - } else { - if (!other.sentences_.isEmpty()) { - if (sentencesBuilder_.isEmpty()) { - sentencesBuilder_.dispose(); - sentencesBuilder_ = null; - sentences_ = other.sentences_; - bitField0_ = (bitField0_ & ~0x00000001); - sentencesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getSentencesFieldBuilder() - : null; - } else { - sentencesBuilder_.addAllMessages(other.sentences_); - } - } - } - if (tokensBuilder_ == null) { - if (!other.tokens_.isEmpty()) { - if (tokens_.isEmpty()) { - tokens_ = other.tokens_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureTokensIsMutable(); - tokens_.addAll(other.tokens_); - } - onChanged(); - } - } else { - if (!other.tokens_.isEmpty()) { - if (tokensBuilder_.isEmpty()) { - tokensBuilder_.dispose(); - tokensBuilder_ = null; - tokens_ = other.tokens_; - bitField0_ = (bitField0_ & ~0x00000002); - tokensBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getTokensFieldBuilder() - : null; - } else { - tokensBuilder_.addAllMessages(other.tokens_); - } - } - } - if (!other.getLanguage().isEmpty()) { - language_ = other.language_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Sentence m = - input.readMessage( - com.google.cloud.language.v1.Sentence.parser(), extensionRegistry); - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(m); - } else { - sentencesBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - com.google.cloud.language.v1.Token m = - input.readMessage( - com.google.cloud.language.v1.Token.parser(), extensionRegistry); - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.add(m); - } else { - tokensBuilder_.addMessage(m); - } - break; - } // case 18 - case 26: - { - language_ = input.readStringRequireUtf8(); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List sentences_ = - java.util.Collections.emptyList(); - - private void ensureSentencesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - sentences_ = new java.util.ArrayList(sentences_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder> - sentencesBuilder_; - - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public java.util.List getSentencesList() { - if (sentencesBuilder_ == null) { - return java.util.Collections.unmodifiableList(sentences_); - } else { - return sentencesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public int getSentencesCount() { - if (sentencesBuilder_ == null) { - return sentences_.size(); - } else { - return sentencesBuilder_.getCount(); - } - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence getSentences(int index) { - if (sentencesBuilder_ == null) { - return sentences_.get(index); - } else { - return sentencesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder setSentences(int index, com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.set(index, value); - onChanged(); - } else { - sentencesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder setSentences( - int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.set(index, builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences(com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.add(value); - onChanged(); - } else { - sentencesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences(int index, com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.add(index, value); - onChanged(); - } else { - sentencesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences(com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences( - int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(index, builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addAllSentences( - java.lang.Iterable values) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, sentences_); - onChanged(); - } else { - sentencesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder clearSentences() { - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - sentencesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder removeSentences(int index) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.remove(index); - onChanged(); - } else { - sentencesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder(int index) { - return getSentencesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { - if (sentencesBuilder_ == null) { - return sentences_.get(index); - } else { - return sentencesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public java.util.List - getSentencesOrBuilderList() { - if (sentencesBuilder_ != null) { - return sentencesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(sentences_); - } - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() { - return getSentencesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Sentence.getDefaultInstance()); - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder(int index) { - return getSentencesFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Sentence.getDefaultInstance()); - } - /** - * - * - *
-     * Sentences in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public java.util.List getSentencesBuilderList() { - return getSentencesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder> - getSentencesFieldBuilder() { - if (sentencesBuilder_ == null) { - sentencesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder>( - sentences_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - sentences_ = null; - } - return sentencesBuilder_; - } - - private java.util.List tokens_ = - java.util.Collections.emptyList(); - - private void ensureTokensIsMutable() { - if (!((bitField0_ & 0x00000002) != 0)) { - tokens_ = new java.util.ArrayList(tokens_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Token, - com.google.cloud.language.v1.Token.Builder, - com.google.cloud.language.v1.TokenOrBuilder> - tokensBuilder_; - - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public java.util.List getTokensList() { - if (tokensBuilder_ == null) { - return java.util.Collections.unmodifiableList(tokens_); - } else { - return tokensBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public int getTokensCount() { - if (tokensBuilder_ == null) { - return tokens_.size(); - } else { - return tokensBuilder_.getCount(); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token getTokens(int index) { - if (tokensBuilder_ == null) { - return tokens_.get(index); - } else { - return tokensBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder setTokens(int index, com.google.cloud.language.v1.Token value) { - if (tokensBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTokensIsMutable(); - tokens_.set(index, value); - onChanged(); - } else { - tokensBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder setTokens( - int index, com.google.cloud.language.v1.Token.Builder builderForValue) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.set(index, builderForValue.build()); - onChanged(); - } else { - tokensBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens(com.google.cloud.language.v1.Token value) { - if (tokensBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTokensIsMutable(); - tokens_.add(value); - onChanged(); - } else { - tokensBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens(int index, com.google.cloud.language.v1.Token value) { - if (tokensBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTokensIsMutable(); - tokens_.add(index, value); - onChanged(); - } else { - tokensBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens(com.google.cloud.language.v1.Token.Builder builderForValue) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.add(builderForValue.build()); - onChanged(); - } else { - tokensBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens( - int index, com.google.cloud.language.v1.Token.Builder builderForValue) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.add(index, builderForValue.build()); - onChanged(); - } else { - tokensBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addAllTokens( - java.lang.Iterable values) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, tokens_); - onChanged(); - } else { - tokensBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder clearTokens() { - if (tokensBuilder_ == null) { - tokens_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - tokensBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder removeTokens(int index) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.remove(index); - onChanged(); - } else { - tokensBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token.Builder getTokensBuilder(int index) { - return getTokensFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index) { - if (tokensBuilder_ == null) { - return tokens_.get(index); - } else { - return tokensBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public java.util.List - getTokensOrBuilderList() { - if (tokensBuilder_ != null) { - return tokensBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(tokens_); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token.Builder addTokensBuilder() { - return getTokensFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Token.getDefaultInstance()); - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token.Builder addTokensBuilder(int index) { - return getTokensFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Token.getDefaultInstance()); - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public java.util.List getTokensBuilderList() { - return getTokensFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Token, - com.google.cloud.language.v1.Token.Builder, - com.google.cloud.language.v1.TokenOrBuilder> - getTokensFieldBuilder() { - if (tokensBuilder_ == null) { - tokensBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Token, - com.google.cloud.language.v1.Token.Builder, - com.google.cloud.language.v1.TokenOrBuilder>( - tokens_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); - tokens_ = null; - } - return tokensBuilder_; - } - - private java.lang.Object language_ = ""; - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 3; - * - * @return The language. - */ - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - language_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 3; - * - * @return The bytes for language. - */ - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 3; - * - * @param value The language to set. - * @return This builder for chaining. - */ - public Builder setLanguage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - language_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 3; - * - * @return This builder for chaining. - */ - public Builder clearLanguage() { - - language_ = getDefaultInstance().getLanguage(); - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 3; - * - * @param value The bytes for language to set. - * @return This builder for chaining. - */ - public Builder setLanguageBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - language_ = 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.language.v1.AnalyzeSyntaxResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSyntaxResponse) - private static final com.google.cloud.language.v1.AnalyzeSyntaxResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSyntaxResponse(); - } - - public static com.google.cloud.language.v1.AnalyzeSyntaxResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnalyzeSyntaxResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnalyzeSyntaxResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java deleted file mode 100644 index 1369f367..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnalyzeSyntaxResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSyntaxResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - java.util.List getSentencesList(); - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - com.google.cloud.language.v1.Sentence getSentences(int index); - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - int getSentencesCount(); - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - java.util.List - getSentencesOrBuilderList(); - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index); - - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - java.util.List getTokensList(); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - com.google.cloud.language.v1.Token getTokens(int index); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - int getTokensCount(); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - java.util.List getTokensOrBuilderList(); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index); - - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 3; - * - * @return The language. - */ - java.lang.String getLanguage(); - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 3; - * - * @return The bytes for language. - */ - com.google.protobuf.ByteString getLanguageBytes(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java deleted file mode 100644 index 6f7603c5..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java +++ /dev/null @@ -1,2477 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The request message for the text annotation API, which can perform multiple
- * analysis types (sentiment, entities, and syntax) in one call.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnnotateTextRequest} - */ -public final class AnnotateTextRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnnotateTextRequest) - AnnotateTextRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnnotateTextRequest.newBuilder() to construct. - private AnnotateTextRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnnotateTextRequest() { - encodingType_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnnotateTextRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnnotateTextRequest.class, - com.google.cloud.language.v1.AnnotateTextRequest.Builder.class); - } - - public interface FeaturesOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnnotateTextRequest.Features) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-     * Extract syntax information.
-     * 
- * - * bool extract_syntax = 1; - * - * @return The extractSyntax. - */ - boolean getExtractSyntax(); - - /** - * - * - *
-     * Extract entities.
-     * 
- * - * bool extract_entities = 2; - * - * @return The extractEntities. - */ - boolean getExtractEntities(); - - /** - * - * - *
-     * Extract document-level sentiment.
-     * 
- * - * bool extract_document_sentiment = 3; - * - * @return The extractDocumentSentiment. - */ - boolean getExtractDocumentSentiment(); - - /** - * - * - *
-     * Extract entities and their associated sentiment.
-     * 
- * - * bool extract_entity_sentiment = 4; - * - * @return The extractEntitySentiment. - */ - boolean getExtractEntitySentiment(); - - /** - * - * - *
-     * Classify the full document into categories.
-     * 
- * - * bool classify_text = 6; - * - * @return The classifyText. - */ - boolean getClassifyText(); - - /** - * - * - *
-     * The model options to use for classification. Defaults to v1 options
-     * if not specified. Only used if `classify_text` is set to true.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - * - * @return Whether the classificationModelOptions field is set. - */ - boolean hasClassificationModelOptions(); - /** - * - * - *
-     * The model options to use for classification. Defaults to v1 options
-     * if not specified. Only used if `classify_text` is set to true.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - * - * @return The classificationModelOptions. - */ - com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions(); - /** - * - * - *
-     * The model options to use for classification. Defaults to v1 options
-     * if not specified. Only used if `classify_text` is set to true.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder - getClassificationModelOptionsOrBuilder(); - } - /** - * - * - *
-   * All available features for sentiment, syntax, and semantic analysis.
-   * Setting each one to true will enable that specific analysis for the input.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnnotateTextRequest.Features} - */ - public static final class Features extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnnotateTextRequest.Features) - FeaturesOrBuilder { - private static final long serialVersionUID = 0L; - // Use Features.newBuilder() to construct. - private Features(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Features() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Features(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnnotateTextRequest.Features.class, - com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder.class); - } - - public static final int EXTRACT_SYNTAX_FIELD_NUMBER = 1; - private boolean extractSyntax_; - /** - * - * - *
-     * Extract syntax information.
-     * 
- * - * bool extract_syntax = 1; - * - * @return The extractSyntax. - */ - @java.lang.Override - public boolean getExtractSyntax() { - return extractSyntax_; - } - - public static final int EXTRACT_ENTITIES_FIELD_NUMBER = 2; - private boolean extractEntities_; - /** - * - * - *
-     * Extract entities.
-     * 
- * - * bool extract_entities = 2; - * - * @return The extractEntities. - */ - @java.lang.Override - public boolean getExtractEntities() { - return extractEntities_; - } - - public static final int EXTRACT_DOCUMENT_SENTIMENT_FIELD_NUMBER = 3; - private boolean extractDocumentSentiment_; - /** - * - * - *
-     * Extract document-level sentiment.
-     * 
- * - * bool extract_document_sentiment = 3; - * - * @return The extractDocumentSentiment. - */ - @java.lang.Override - public boolean getExtractDocumentSentiment() { - return extractDocumentSentiment_; - } - - public static final int EXTRACT_ENTITY_SENTIMENT_FIELD_NUMBER = 4; - private boolean extractEntitySentiment_; - /** - * - * - *
-     * Extract entities and their associated sentiment.
-     * 
- * - * bool extract_entity_sentiment = 4; - * - * @return The extractEntitySentiment. - */ - @java.lang.Override - public boolean getExtractEntitySentiment() { - return extractEntitySentiment_; - } - - public static final int CLASSIFY_TEXT_FIELD_NUMBER = 6; - private boolean classifyText_; - /** - * - * - *
-     * Classify the full document into categories.
-     * 
- * - * bool classify_text = 6; - * - * @return The classifyText. - */ - @java.lang.Override - public boolean getClassifyText() { - return classifyText_; - } - - public static final int CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER = 10; - private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; - /** - * - * - *
-     * The model options to use for classification. Defaults to v1 options
-     * if not specified. Only used if `classify_text` is set to true.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - * - * @return Whether the classificationModelOptions field is set. - */ - @java.lang.Override - public boolean hasClassificationModelOptions() { - return classificationModelOptions_ != null; - } - /** - * - * - *
-     * The model options to use for classification. Defaults to v1 options
-     * if not specified. Only used if `classify_text` is set to true.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - * - * @return The classificationModelOptions. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions() { - return classificationModelOptions_ == null - ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() - : classificationModelOptions_; - } - /** - * - * - *
-     * The model options to use for classification. Defaults to v1 options
-     * if not specified. Only used if `classify_text` is set to true.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder - getClassificationModelOptionsOrBuilder() { - return getClassificationModelOptions(); - } - - 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 (extractSyntax_ != false) { - output.writeBool(1, extractSyntax_); - } - if (extractEntities_ != false) { - output.writeBool(2, extractEntities_); - } - if (extractDocumentSentiment_ != false) { - output.writeBool(3, extractDocumentSentiment_); - } - if (extractEntitySentiment_ != false) { - output.writeBool(4, extractEntitySentiment_); - } - if (classifyText_ != false) { - output.writeBool(6, classifyText_); - } - if (classificationModelOptions_ != null) { - output.writeMessage(10, getClassificationModelOptions()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (extractSyntax_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, extractSyntax_); - } - if (extractEntities_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, extractEntities_); - } - if (extractDocumentSentiment_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, extractDocumentSentiment_); - } - if (extractEntitySentiment_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, extractEntitySentiment_); - } - if (classifyText_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, classifyText_); - } - if (classificationModelOptions_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 10, getClassificationModelOptions()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextRequest.Features)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnnotateTextRequest.Features other = - (com.google.cloud.language.v1.AnnotateTextRequest.Features) obj; - - if (getExtractSyntax() != other.getExtractSyntax()) return false; - if (getExtractEntities() != other.getExtractEntities()) return false; - if (getExtractDocumentSentiment() != other.getExtractDocumentSentiment()) return false; - if (getExtractEntitySentiment() != other.getExtractEntitySentiment()) return false; - if (getClassifyText() != other.getClassifyText()) return false; - if (hasClassificationModelOptions() != other.hasClassificationModelOptions()) return false; - if (hasClassificationModelOptions()) { - if (!getClassificationModelOptions().equals(other.getClassificationModelOptions())) - return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + EXTRACT_SYNTAX_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractSyntax()); - hash = (37 * hash) + EXTRACT_ENTITIES_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractEntities()); - hash = (37 * hash) + EXTRACT_DOCUMENT_SENTIMENT_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractDocumentSentiment()); - hash = (37 * hash) + EXTRACT_ENTITY_SENTIMENT_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getExtractEntitySentiment()); - hash = (37 * hash) + CLASSIFY_TEXT_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getClassifyText()); - if (hasClassificationModelOptions()) { - hash = (37 * hash) + CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER; - hash = (53 * hash) + getClassificationModelOptions().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features 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.language.v1.AnnotateTextRequest.Features parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features 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.language.v1.AnnotateTextRequest.Features parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features 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.language.v1.AnnotateTextRequest.Features parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features 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.language.v1.AnnotateTextRequest.Features parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features 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.language.v1.AnnotateTextRequest.Features 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; - } - /** - * - * - *
-     * All available features for sentiment, syntax, and semantic analysis.
-     * Setting each one to true will enable that specific analysis for the input.
-     * 
- * - * Protobuf type {@code google.cloud.language.v1.AnnotateTextRequest.Features} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnnotateTextRequest.Features) - com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnnotateTextRequest.Features.class, - com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnnotateTextRequest.Features.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - extractSyntax_ = false; - - extractEntities_ = false; - - extractDocumentSentiment_ = false; - - extractEntitySentiment_ = false; - - classifyText_ = false; - - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptions_ = null; - } else { - classificationModelOptions_ = null; - classificationModelOptionsBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest.Features getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest.Features build() { - com.google.cloud.language.v1.AnnotateTextRequest.Features result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest.Features buildPartial() { - com.google.cloud.language.v1.AnnotateTextRequest.Features result = - new com.google.cloud.language.v1.AnnotateTextRequest.Features(this); - result.extractSyntax_ = extractSyntax_; - result.extractEntities_ = extractEntities_; - result.extractDocumentSentiment_ = extractDocumentSentiment_; - result.extractEntitySentiment_ = extractEntitySentiment_; - result.classifyText_ = classifyText_; - if (classificationModelOptionsBuilder_ == null) { - result.classificationModelOptions_ = classificationModelOptions_; - } else { - result.classificationModelOptions_ = classificationModelOptionsBuilder_.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.language.v1.AnnotateTextRequest.Features) { - return mergeFrom((com.google.cloud.language.v1.AnnotateTextRequest.Features) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextRequest.Features other) { - if (other == com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance()) - return this; - if (other.getExtractSyntax() != false) { - setExtractSyntax(other.getExtractSyntax()); - } - if (other.getExtractEntities() != false) { - setExtractEntities(other.getExtractEntities()); - } - if (other.getExtractDocumentSentiment() != false) { - setExtractDocumentSentiment(other.getExtractDocumentSentiment()); - } - if (other.getExtractEntitySentiment() != false) { - setExtractEntitySentiment(other.getExtractEntitySentiment()); - } - if (other.getClassifyText() != false) { - setClassifyText(other.getClassifyText()); - } - if (other.hasClassificationModelOptions()) { - mergeClassificationModelOptions(other.getClassificationModelOptions()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - extractSyntax_ = input.readBool(); - - break; - } // case 8 - case 16: - { - extractEntities_ = input.readBool(); - - break; - } // case 16 - case 24: - { - extractDocumentSentiment_ = input.readBool(); - - break; - } // case 24 - case 32: - { - extractEntitySentiment_ = input.readBool(); - - break; - } // case 32 - case 48: - { - classifyText_ = input.readBool(); - - break; - } // case 48 - case 82: - { - input.readMessage( - getClassificationModelOptionsFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 82 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private boolean extractSyntax_; - /** - * - * - *
-       * Extract syntax information.
-       * 
- * - * bool extract_syntax = 1; - * - * @return The extractSyntax. - */ - @java.lang.Override - public boolean getExtractSyntax() { - return extractSyntax_; - } - /** - * - * - *
-       * Extract syntax information.
-       * 
- * - * bool extract_syntax = 1; - * - * @param value The extractSyntax to set. - * @return This builder for chaining. - */ - public Builder setExtractSyntax(boolean value) { - - extractSyntax_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract syntax information.
-       * 
- * - * bool extract_syntax = 1; - * - * @return This builder for chaining. - */ - public Builder clearExtractSyntax() { - - extractSyntax_ = false; - onChanged(); - return this; - } - - private boolean extractEntities_; - /** - * - * - *
-       * Extract entities.
-       * 
- * - * bool extract_entities = 2; - * - * @return The extractEntities. - */ - @java.lang.Override - public boolean getExtractEntities() { - return extractEntities_; - } - /** - * - * - *
-       * Extract entities.
-       * 
- * - * bool extract_entities = 2; - * - * @param value The extractEntities to set. - * @return This builder for chaining. - */ - public Builder setExtractEntities(boolean value) { - - extractEntities_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract entities.
-       * 
- * - * bool extract_entities = 2; - * - * @return This builder for chaining. - */ - public Builder clearExtractEntities() { - - extractEntities_ = false; - onChanged(); - return this; - } - - private boolean extractDocumentSentiment_; - /** - * - * - *
-       * Extract document-level sentiment.
-       * 
- * - * bool extract_document_sentiment = 3; - * - * @return The extractDocumentSentiment. - */ - @java.lang.Override - public boolean getExtractDocumentSentiment() { - return extractDocumentSentiment_; - } - /** - * - * - *
-       * Extract document-level sentiment.
-       * 
- * - * bool extract_document_sentiment = 3; - * - * @param value The extractDocumentSentiment to set. - * @return This builder for chaining. - */ - public Builder setExtractDocumentSentiment(boolean value) { - - extractDocumentSentiment_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract document-level sentiment.
-       * 
- * - * bool extract_document_sentiment = 3; - * - * @return This builder for chaining. - */ - public Builder clearExtractDocumentSentiment() { - - extractDocumentSentiment_ = false; - onChanged(); - return this; - } - - private boolean extractEntitySentiment_; - /** - * - * - *
-       * Extract entities and their associated sentiment.
-       * 
- * - * bool extract_entity_sentiment = 4; - * - * @return The extractEntitySentiment. - */ - @java.lang.Override - public boolean getExtractEntitySentiment() { - return extractEntitySentiment_; - } - /** - * - * - *
-       * Extract entities and their associated sentiment.
-       * 
- * - * bool extract_entity_sentiment = 4; - * - * @param value The extractEntitySentiment to set. - * @return This builder for chaining. - */ - public Builder setExtractEntitySentiment(boolean value) { - - extractEntitySentiment_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract entities and their associated sentiment.
-       * 
- * - * bool extract_entity_sentiment = 4; - * - * @return This builder for chaining. - */ - public Builder clearExtractEntitySentiment() { - - extractEntitySentiment_ = false; - onChanged(); - return this; - } - - private boolean classifyText_; - /** - * - * - *
-       * Classify the full document into categories.
-       * 
- * - * bool classify_text = 6; - * - * @return The classifyText. - */ - @java.lang.Override - public boolean getClassifyText() { - return classifyText_; - } - /** - * - * - *
-       * Classify the full document into categories.
-       * 
- * - * bool classify_text = 6; - * - * @param value The classifyText to set. - * @return This builder for chaining. - */ - public Builder setClassifyText(boolean value) { - - classifyText_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Classify the full document into categories.
-       * 
- * - * bool classify_text = 6; - * - * @return This builder for chaining. - */ - public Builder clearClassifyText() { - - classifyText_ = false; - onChanged(); - return this; - } - - private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions, - com.google.cloud.language.v1.ClassificationModelOptions.Builder, - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> - classificationModelOptionsBuilder_; - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - * - * @return Whether the classificationModelOptions field is set. - */ - public boolean hasClassificationModelOptions() { - return classificationModelOptionsBuilder_ != null || classificationModelOptions_ != null; - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - * - * @return The classificationModelOptions. - */ - public com.google.cloud.language.v1.ClassificationModelOptions - getClassificationModelOptions() { - if (classificationModelOptionsBuilder_ == null) { - return classificationModelOptions_ == null - ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() - : classificationModelOptions_; - } else { - return classificationModelOptionsBuilder_.getMessage(); - } - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - public Builder setClassificationModelOptions( - com.google.cloud.language.v1.ClassificationModelOptions value) { - if (classificationModelOptionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - classificationModelOptions_ = value; - onChanged(); - } else { - classificationModelOptionsBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - public Builder setClassificationModelOptions( - com.google.cloud.language.v1.ClassificationModelOptions.Builder builderForValue) { - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptions_ = builderForValue.build(); - onChanged(); - } else { - classificationModelOptionsBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - public Builder mergeClassificationModelOptions( - com.google.cloud.language.v1.ClassificationModelOptions value) { - if (classificationModelOptionsBuilder_ == null) { - if (classificationModelOptions_ != null) { - classificationModelOptions_ = - com.google.cloud.language.v1.ClassificationModelOptions.newBuilder( - classificationModelOptions_) - .mergeFrom(value) - .buildPartial(); - } else { - classificationModelOptions_ = value; - } - onChanged(); - } else { - classificationModelOptionsBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - public Builder clearClassificationModelOptions() { - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptions_ = null; - onChanged(); - } else { - classificationModelOptions_ = null; - classificationModelOptionsBuilder_ = null; - } - - return this; - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - public com.google.cloud.language.v1.ClassificationModelOptions.Builder - getClassificationModelOptionsBuilder() { - - onChanged(); - return getClassificationModelOptionsFieldBuilder().getBuilder(); - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder - getClassificationModelOptionsOrBuilder() { - if (classificationModelOptionsBuilder_ != null) { - return classificationModelOptionsBuilder_.getMessageOrBuilder(); - } else { - return classificationModelOptions_ == null - ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() - : classificationModelOptions_; - } - } - /** - * - * - *
-       * The model options to use for classification. Defaults to v1 options
-       * if not specified. Only used if `classify_text` is set to true.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions, - com.google.cloud.language.v1.ClassificationModelOptions.Builder, - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> - getClassificationModelOptionsFieldBuilder() { - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptionsBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions, - com.google.cloud.language.v1.ClassificationModelOptions.Builder, - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder>( - getClassificationModelOptions(), getParentForChildren(), isClean()); - classificationModelOptions_ = null; - } - return classificationModelOptionsBuilder_; - } - - @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.language.v1.AnnotateTextRequest.Features) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnnotateTextRequest.Features) - private static final com.google.cloud.language.v1.AnnotateTextRequest.Features DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnnotateTextRequest.Features(); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest.Features getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Features parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest.Features getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public static final int DOCUMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Document document_; - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - @java.lang.Override - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - @java.lang.Override - public com.google.cloud.language.v1.Document getDocument() { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - return getDocument(); - } - - public static final int FEATURES_FIELD_NUMBER = 2; - private com.google.cloud.language.v1.AnnotateTextRequest.Features features_; - /** - * - * - *
-   * Required. The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the features field is set. - */ - @java.lang.Override - public boolean hasFeatures() { - return features_ != null; - } - /** - * - * - *
-   * Required. The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The features. - */ - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures() { - return features_ == null - ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() - : features_; - } - /** - * - * - *
-   * Required. The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder getFeaturesOrBuilder() { - return getFeatures(); - } - - public static final int ENCODING_TYPE_FIELD_NUMBER = 3; - private int encodingType_; - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - - 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 (document_ != null) { - output.writeMessage(1, getDocument()); - } - if (features_ != null) { - output.writeMessage(2, getFeatures()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - output.writeEnum(3, encodingType_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (document_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); - } - if (features_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getFeatures()); - } - if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, encodingType_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextRequest)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnnotateTextRequest other = - (com.google.cloud.language.v1.AnnotateTextRequest) obj; - - if (hasDocument() != other.hasDocument()) return false; - if (hasDocument()) { - if (!getDocument().equals(other.getDocument())) return false; - } - if (hasFeatures() != other.hasFeatures()) return false; - if (hasFeatures()) { - if (!getFeatures().equals(other.getFeatures())) return false; - } - if (encodingType_ != other.encodingType_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocument()) { - hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocument().hashCode(); - } - if (hasFeatures()) { - hash = (37 * hash) + FEATURES_FIELD_NUMBER; - hash = (53 * hash) + getFeatures().hashCode(); - } - hash = (37 * hash) + ENCODING_TYPE_FIELD_NUMBER; - hash = (53 * hash) + encodingType_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnnotateTextRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest 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.language.v1.AnnotateTextRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest 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.language.v1.AnnotateTextRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest 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.language.v1.AnnotateTextRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest 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.language.v1.AnnotateTextRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest 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.language.v1.AnnotateTextRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The request message for the text annotation API, which can perform multiple
-   * analysis types (sentiment, entities, and syntax) in one call.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnnotateTextRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnnotateTextRequest) - com.google.cloud.language.v1.AnnotateTextRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnnotateTextRequest.class, - com.google.cloud.language.v1.AnnotateTextRequest.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnnotateTextRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentBuilder_ == null) { - document_ = null; - } else { - document_ = null; - documentBuilder_ = null; - } - if (featuresBuilder_ == null) { - features_ = null; - } else { - features_ = null; - featuresBuilder_ = null; - } - encodingType_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnnotateTextRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest build() { - com.google.cloud.language.v1.AnnotateTextRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest buildPartial() { - com.google.cloud.language.v1.AnnotateTextRequest result = - new com.google.cloud.language.v1.AnnotateTextRequest(this); - if (documentBuilder_ == null) { - result.document_ = document_; - } else { - result.document_ = documentBuilder_.build(); - } - if (featuresBuilder_ == null) { - result.features_ = features_; - } else { - result.features_ = featuresBuilder_.build(); - } - result.encodingType_ = encodingType_; - 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.language.v1.AnnotateTextRequest) { - return mergeFrom((com.google.cloud.language.v1.AnnotateTextRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextRequest other) { - if (other == com.google.cloud.language.v1.AnnotateTextRequest.getDefaultInstance()) - return this; - if (other.hasDocument()) { - mergeDocument(other.getDocument()); - } - if (other.hasFeatures()) { - mergeFeatures(other.getFeatures()); - } - if (other.encodingType_ != 0) { - setEncodingTypeValue(other.getEncodingTypeValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getDocumentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 18: - { - input.readMessage(getFeaturesFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 18 - case 24: - { - encodingType_ = input.readEnum(); - - break; - } // case 24 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.language.v1.Document document_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - documentBuilder_; - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - public com.google.cloud.language.v1.Document getDocument() { - if (documentBuilder_ == null) { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } else { - return documentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - document_ = value; - onChanged(); - } else { - documentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document.Builder builderForValue) { - if (documentBuilder_ == null) { - document_ = builderForValue.build(); - onChanged(); - } else { - documentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (document_ != null) { - document_ = - com.google.cloud.language.v1.Document.newBuilder(document_) - .mergeFrom(value) - .buildPartial(); - } else { - document_ = value; - } - onChanged(); - } else { - documentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDocument() { - if (documentBuilder_ == null) { - document_ = null; - onChanged(); - } else { - document_ = null; - documentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { - - onChanged(); - return getDocumentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - if (documentBuilder_ != null) { - return documentBuilder_.getMessageOrBuilder(); - } else { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - getDocumentFieldBuilder() { - if (documentBuilder_ == null) { - documentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder>( - getDocument(), getParentForChildren(), isClean()); - document_ = null; - } - return documentBuilder_; - } - - private com.google.cloud.language.v1.AnnotateTextRequest.Features features_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.AnnotateTextRequest.Features, - com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder, - com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder> - featuresBuilder_; - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the features field is set. - */ - public boolean hasFeatures() { - return featuresBuilder_ != null || features_ != null; - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The features. - */ - public com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures() { - if (featuresBuilder_ == null) { - return features_ == null - ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() - : features_; - } else { - return featuresBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setFeatures(com.google.cloud.language.v1.AnnotateTextRequest.Features value) { - if (featuresBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - features_ = value; - onChanged(); - } else { - featuresBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setFeatures( - com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder builderForValue) { - if (featuresBuilder_ == null) { - features_ = builderForValue.build(); - onChanged(); - } else { - featuresBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeFeatures(com.google.cloud.language.v1.AnnotateTextRequest.Features value) { - if (featuresBuilder_ == null) { - if (features_ != null) { - features_ = - com.google.cloud.language.v1.AnnotateTextRequest.Features.newBuilder(features_) - .mergeFrom(value) - .buildPartial(); - } else { - features_ = value; - } - onChanged(); - } else { - featuresBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearFeatures() { - if (featuresBuilder_ == null) { - features_ = null; - onChanged(); - } else { - features_ = null; - featuresBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder getFeaturesBuilder() { - - onChanged(); - return getFeaturesFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder - getFeaturesOrBuilder() { - if (featuresBuilder_ != null) { - return featuresBuilder_.getMessageOrBuilder(); - } else { - return features_ == null - ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() - : features_; - } - } - /** - * - * - *
-     * Required. The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.AnnotateTextRequest.Features, - com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder, - com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder> - getFeaturesFieldBuilder() { - if (featuresBuilder_ == null) { - featuresBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.AnnotateTextRequest.Features, - com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder, - com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder>( - getFeatures(), getParentForChildren(), isClean()); - features_ = null; - } - return featuresBuilder_; - } - - private int encodingType_ = 0; - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @return The enum numeric value on the wire for encodingType. - */ - @java.lang.Override - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @param value The enum numeric value on the wire for encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingTypeValue(int value) { - - encodingType_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @return The encodingType. - */ - @java.lang.Override - public com.google.cloud.language.v1.EncodingType getEncodingType() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.EncodingType result = - com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); - return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @param value The encodingType to set. - * @return This builder for chaining. - */ - public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { - if (value == null) { - throw new NullPointerException(); - } - - encodingType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @return This builder for chaining. - */ - public Builder clearEncodingType() { - - encodingType_ = 0; - 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.language.v1.AnnotateTextRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnnotateTextRequest) - private static final com.google.cloud.language.v1.AnnotateTextRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnnotateTextRequest(); - } - - public static com.google.cloud.language.v1.AnnotateTextRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnnotateTextRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java deleted file mode 100644 index db69924b..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnnotateTextRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnnotateTextRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); - - /** - * - * - *
-   * Required. The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the features field is set. - */ - boolean hasFeatures(); - /** - * - * - *
-   * Required. The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The features. - */ - com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures(); - /** - * - * - *
-   * Required. The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder getFeaturesOrBuilder(); - - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @return The enum numeric value on the wire for encodingType. - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - * - * @return The encodingType. - */ - com.google.cloud.language.v1.EncodingType getEncodingType(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java deleted file mode 100644 index 9f3ad604..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java +++ /dev/null @@ -1,2980 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The text annotations response message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.AnnotateTextResponse} - */ -public final class AnnotateTextResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnnotateTextResponse) - AnnotateTextResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use AnnotateTextResponse.newBuilder() to construct. - private AnnotateTextResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private AnnotateTextResponse() { - sentences_ = java.util.Collections.emptyList(); - tokens_ = java.util.Collections.emptyList(); - entities_ = java.util.Collections.emptyList(); - language_ = ""; - categories_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new AnnotateTextResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnnotateTextResponse.class, - com.google.cloud.language.v1.AnnotateTextResponse.Builder.class); - } - - public static final int SENTENCES_FIELD_NUMBER = 1; - private java.util.List sentences_; - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public java.util.List getSentencesList() { - return sentences_; - } - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public java.util.List - getSentencesOrBuilderList() { - return sentences_; - } - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public int getSentencesCount() { - return sentences_.size(); - } - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.Sentence getSentences(int index) { - return sentences_.get(index); - } - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { - return sentences_.get(index); - } - - public static final int TOKENS_FIELD_NUMBER = 2; - private java.util.List tokens_; - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public java.util.List getTokensList() { - return tokens_; - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public java.util.List - getTokensOrBuilderList() { - return tokens_; - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public int getTokensCount() { - return tokens_.size(); - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public com.google.cloud.language.v1.Token getTokens(int index) { - return tokens_.get(index); - } - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - @java.lang.Override - public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index) { - return tokens_.get(index); - } - - public static final int ENTITIES_FIELD_NUMBER = 3; - private java.util.List entities_; - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - @java.lang.Override - public java.util.List getEntitiesList() { - return entities_; - } - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - @java.lang.Override - public java.util.List - getEntitiesOrBuilderList() { - return entities_; - } - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - @java.lang.Override - public int getEntitiesCount() { - return entities_.size(); - } - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - @java.lang.Override - public com.google.cloud.language.v1.Entity getEntities(int index) { - return entities_.get(index); - } - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - @java.lang.Override - public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { - return entities_.get(index); - } - - public static final int DOCUMENT_SENTIMENT_FIELD_NUMBER = 4; - private com.google.cloud.language.v1.Sentiment documentSentiment_; - /** - * - * - *
-   * The overall sentiment for the document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - * - * @return Whether the documentSentiment field is set. - */ - @java.lang.Override - public boolean hasDocumentSentiment() { - return documentSentiment_ != null; - } - /** - * - * - *
-   * The overall sentiment for the document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - * - * @return The documentSentiment. - */ - @java.lang.Override - public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { - return documentSentiment_ == null - ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() - : documentSentiment_; - } - /** - * - * - *
-   * The overall sentiment for the document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - @java.lang.Override - public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { - return getDocumentSentiment(); - } - - public static final int LANGUAGE_FIELD_NUMBER = 5; - private volatile java.lang.Object language_; - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 5; - * - * @return The language. - */ - @java.lang.Override - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - 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(); - language_ = s; - return s; - } - } - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 5; - * - * @return The bytes for language. - */ - @java.lang.Override - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CATEGORIES_FIELD_NUMBER = 6; - private java.util.List categories_; - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - @java.lang.Override - public java.util.List getCategoriesList() { - return categories_; - } - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - @java.lang.Override - public java.util.List - getCategoriesOrBuilderList() { - return categories_; - } - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - @java.lang.Override - public int getCategoriesCount() { - return categories_.size(); - } - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { - return categories_.get(index); - } - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( - int index) { - return categories_.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 < sentences_.size(); i++) { - output.writeMessage(1, sentences_.get(i)); - } - for (int i = 0; i < tokens_.size(); i++) { - output.writeMessage(2, tokens_.get(i)); - } - for (int i = 0; i < entities_.size(); i++) { - output.writeMessage(3, entities_.get(i)); - } - if (documentSentiment_ != null) { - output.writeMessage(4, getDocumentSentiment()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, language_); - } - for (int i = 0; i < categories_.size(); i++) { - output.writeMessage(6, categories_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < sentences_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, sentences_.get(i)); - } - for (int i = 0; i < tokens_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, tokens_.get(i)); - } - for (int i = 0; i < entities_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, entities_.get(i)); - } - if (documentSentiment_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getDocumentSentiment()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, language_); - } - for (int i = 0; i < categories_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, categories_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextResponse)) { - return super.equals(obj); - } - com.google.cloud.language.v1.AnnotateTextResponse other = - (com.google.cloud.language.v1.AnnotateTextResponse) obj; - - if (!getSentencesList().equals(other.getSentencesList())) return false; - if (!getTokensList().equals(other.getTokensList())) return false; - if (!getEntitiesList().equals(other.getEntitiesList())) return false; - if (hasDocumentSentiment() != other.hasDocumentSentiment()) return false; - if (hasDocumentSentiment()) { - if (!getDocumentSentiment().equals(other.getDocumentSentiment())) return false; - } - if (!getLanguage().equals(other.getLanguage())) return false; - if (!getCategoriesList().equals(other.getCategoriesList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getSentencesCount() > 0) { - hash = (37 * hash) + SENTENCES_FIELD_NUMBER; - hash = (53 * hash) + getSentencesList().hashCode(); - } - if (getTokensCount() > 0) { - hash = (37 * hash) + TOKENS_FIELD_NUMBER; - hash = (53 * hash) + getTokensList().hashCode(); - } - if (getEntitiesCount() > 0) { - hash = (37 * hash) + ENTITIES_FIELD_NUMBER; - hash = (53 * hash) + getEntitiesList().hashCode(); - } - if (hasDocumentSentiment()) { - hash = (37 * hash) + DOCUMENT_SENTIMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocumentSentiment().hashCode(); - } - hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; - hash = (53 * hash) + getLanguage().hashCode(); - if (getCategoriesCount() > 0) { - hash = (37 * hash) + CATEGORIES_FIELD_NUMBER; - hash = (53 * hash) + getCategoriesList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse 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.language.v1.AnnotateTextResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse 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.language.v1.AnnotateTextResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse 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.language.v1.AnnotateTextResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse 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.language.v1.AnnotateTextResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse 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.language.v1.AnnotateTextResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The text annotations response message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.AnnotateTextResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnnotateTextResponse) - com.google.cloud.language.v1.AnnotateTextResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.AnnotateTextResponse.class, - com.google.cloud.language.v1.AnnotateTextResponse.Builder.class); - } - - // Construct using com.google.cloud.language.v1.AnnotateTextResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - } else { - sentences_ = null; - sentencesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (tokensBuilder_ == null) { - tokens_ = java.util.Collections.emptyList(); - } else { - tokens_ = null; - tokensBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - } else { - entities_ = null; - entitiesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - if (documentSentimentBuilder_ == null) { - documentSentiment_ = null; - } else { - documentSentiment_ = null; - documentSentimentBuilder_ = null; - } - language_ = ""; - - if (categoriesBuilder_ == null) { - categories_ = java.util.Collections.emptyList(); - } else { - categories_ = null; - categoriesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstanceForType() { - return com.google.cloud.language.v1.AnnotateTextResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextResponse build() { - com.google.cloud.language.v1.AnnotateTextResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextResponse buildPartial() { - com.google.cloud.language.v1.AnnotateTextResponse result = - new com.google.cloud.language.v1.AnnotateTextResponse(this); - int from_bitField0_ = bitField0_; - if (sentencesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - sentences_ = java.util.Collections.unmodifiableList(sentences_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.sentences_ = sentences_; - } else { - result.sentences_ = sentencesBuilder_.build(); - } - if (tokensBuilder_ == null) { - if (((bitField0_ & 0x00000002) != 0)) { - tokens_ = java.util.Collections.unmodifiableList(tokens_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.tokens_ = tokens_; - } else { - result.tokens_ = tokensBuilder_.build(); - } - if (entitiesBuilder_ == null) { - if (((bitField0_ & 0x00000004) != 0)) { - entities_ = java.util.Collections.unmodifiableList(entities_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.entities_ = entities_; - } else { - result.entities_ = entitiesBuilder_.build(); - } - if (documentSentimentBuilder_ == null) { - result.documentSentiment_ = documentSentiment_; - } else { - result.documentSentiment_ = documentSentimentBuilder_.build(); - } - result.language_ = language_; - if (categoriesBuilder_ == null) { - if (((bitField0_ & 0x00000008) != 0)) { - categories_ = java.util.Collections.unmodifiableList(categories_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.categories_ = categories_; - } else { - result.categories_ = categoriesBuilder_.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.language.v1.AnnotateTextResponse) { - return mergeFrom((com.google.cloud.language.v1.AnnotateTextResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextResponse other) { - if (other == com.google.cloud.language.v1.AnnotateTextResponse.getDefaultInstance()) - return this; - if (sentencesBuilder_ == null) { - if (!other.sentences_.isEmpty()) { - if (sentences_.isEmpty()) { - sentences_ = other.sentences_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureSentencesIsMutable(); - sentences_.addAll(other.sentences_); - } - onChanged(); - } - } else { - if (!other.sentences_.isEmpty()) { - if (sentencesBuilder_.isEmpty()) { - sentencesBuilder_.dispose(); - sentencesBuilder_ = null; - sentences_ = other.sentences_; - bitField0_ = (bitField0_ & ~0x00000001); - sentencesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getSentencesFieldBuilder() - : null; - } else { - sentencesBuilder_.addAllMessages(other.sentences_); - } - } - } - if (tokensBuilder_ == null) { - if (!other.tokens_.isEmpty()) { - if (tokens_.isEmpty()) { - tokens_ = other.tokens_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureTokensIsMutable(); - tokens_.addAll(other.tokens_); - } - onChanged(); - } - } else { - if (!other.tokens_.isEmpty()) { - if (tokensBuilder_.isEmpty()) { - tokensBuilder_.dispose(); - tokensBuilder_ = null; - tokens_ = other.tokens_; - bitField0_ = (bitField0_ & ~0x00000002); - tokensBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getTokensFieldBuilder() - : null; - } else { - tokensBuilder_.addAllMessages(other.tokens_); - } - } - } - if (entitiesBuilder_ == null) { - if (!other.entities_.isEmpty()) { - if (entities_.isEmpty()) { - entities_ = other.entities_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureEntitiesIsMutable(); - entities_.addAll(other.entities_); - } - onChanged(); - } - } else { - if (!other.entities_.isEmpty()) { - if (entitiesBuilder_.isEmpty()) { - entitiesBuilder_.dispose(); - entitiesBuilder_ = null; - entities_ = other.entities_; - bitField0_ = (bitField0_ & ~0x00000004); - entitiesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getEntitiesFieldBuilder() - : null; - } else { - entitiesBuilder_.addAllMessages(other.entities_); - } - } - } - if (other.hasDocumentSentiment()) { - mergeDocumentSentiment(other.getDocumentSentiment()); - } - if (!other.getLanguage().isEmpty()) { - language_ = other.language_; - onChanged(); - } - if (categoriesBuilder_ == null) { - if (!other.categories_.isEmpty()) { - if (categories_.isEmpty()) { - categories_ = other.categories_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureCategoriesIsMutable(); - categories_.addAll(other.categories_); - } - onChanged(); - } - } else { - if (!other.categories_.isEmpty()) { - if (categoriesBuilder_.isEmpty()) { - categoriesBuilder_.dispose(); - categoriesBuilder_ = null; - categories_ = other.categories_; - bitField0_ = (bitField0_ & ~0x00000008); - categoriesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getCategoriesFieldBuilder() - : null; - } else { - categoriesBuilder_.addAllMessages(other.categories_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Sentence m = - input.readMessage( - com.google.cloud.language.v1.Sentence.parser(), extensionRegistry); - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(m); - } else { - sentencesBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - com.google.cloud.language.v1.Token m = - input.readMessage( - com.google.cloud.language.v1.Token.parser(), extensionRegistry); - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.add(m); - } else { - tokensBuilder_.addMessage(m); - } - break; - } // case 18 - case 26: - { - com.google.cloud.language.v1.Entity m = - input.readMessage( - com.google.cloud.language.v1.Entity.parser(), extensionRegistry); - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(m); - } else { - entitiesBuilder_.addMessage(m); - } - break; - } // case 26 - case 34: - { - input.readMessage( - getDocumentSentimentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 34 - case 42: - { - language_ = input.readStringRequireUtf8(); - - break; - } // case 42 - case 50: - { - com.google.cloud.language.v1.ClassificationCategory m = - input.readMessage( - com.google.cloud.language.v1.ClassificationCategory.parser(), - extensionRegistry); - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.add(m); - } else { - categoriesBuilder_.addMessage(m); - } - break; - } // case 50 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List sentences_ = - java.util.Collections.emptyList(); - - private void ensureSentencesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - sentences_ = new java.util.ArrayList(sentences_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder> - sentencesBuilder_; - - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public java.util.List getSentencesList() { - if (sentencesBuilder_ == null) { - return java.util.Collections.unmodifiableList(sentences_); - } else { - return sentencesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public int getSentencesCount() { - if (sentencesBuilder_ == null) { - return sentences_.size(); - } else { - return sentencesBuilder_.getCount(); - } - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence getSentences(int index) { - if (sentencesBuilder_ == null) { - return sentences_.get(index); - } else { - return sentencesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder setSentences(int index, com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.set(index, value); - onChanged(); - } else { - sentencesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder setSentences( - int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.set(index, builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences(com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.add(value); - onChanged(); - } else { - sentencesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences(int index, com.google.cloud.language.v1.Sentence value) { - if (sentencesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSentencesIsMutable(); - sentences_.add(index, value); - onChanged(); - } else { - sentencesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences(com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addSentences( - int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.add(index, builderForValue.build()); - onChanged(); - } else { - sentencesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder addAllSentences( - java.lang.Iterable values) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, sentences_); - onChanged(); - } else { - sentencesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder clearSentences() { - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - sentencesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public Builder removeSentences(int index) { - if (sentencesBuilder_ == null) { - ensureSentencesIsMutable(); - sentences_.remove(index); - onChanged(); - } else { - sentencesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder(int index) { - return getSentencesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { - if (sentencesBuilder_ == null) { - return sentences_.get(index); - } else { - return sentencesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public java.util.List - getSentencesOrBuilderList() { - if (sentencesBuilder_ != null) { - return sentencesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(sentences_); - } - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() { - return getSentencesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Sentence.getDefaultInstance()); - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder(int index) { - return getSentencesFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Sentence.getDefaultInstance()); - } - /** - * - * - *
-     * Sentences in the input document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public java.util.List getSentencesBuilderList() { - return getSentencesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder> - getSentencesFieldBuilder() { - if (sentencesBuilder_ == null) { - sentencesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Sentence, - com.google.cloud.language.v1.Sentence.Builder, - com.google.cloud.language.v1.SentenceOrBuilder>( - sentences_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - sentences_ = null; - } - return sentencesBuilder_; - } - - private java.util.List tokens_ = - java.util.Collections.emptyList(); - - private void ensureTokensIsMutable() { - if (!((bitField0_ & 0x00000002) != 0)) { - tokens_ = new java.util.ArrayList(tokens_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Token, - com.google.cloud.language.v1.Token.Builder, - com.google.cloud.language.v1.TokenOrBuilder> - tokensBuilder_; - - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public java.util.List getTokensList() { - if (tokensBuilder_ == null) { - return java.util.Collections.unmodifiableList(tokens_); - } else { - return tokensBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public int getTokensCount() { - if (tokensBuilder_ == null) { - return tokens_.size(); - } else { - return tokensBuilder_.getCount(); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token getTokens(int index) { - if (tokensBuilder_ == null) { - return tokens_.get(index); - } else { - return tokensBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder setTokens(int index, com.google.cloud.language.v1.Token value) { - if (tokensBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTokensIsMutable(); - tokens_.set(index, value); - onChanged(); - } else { - tokensBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder setTokens( - int index, com.google.cloud.language.v1.Token.Builder builderForValue) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.set(index, builderForValue.build()); - onChanged(); - } else { - tokensBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens(com.google.cloud.language.v1.Token value) { - if (tokensBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTokensIsMutable(); - tokens_.add(value); - onChanged(); - } else { - tokensBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens(int index, com.google.cloud.language.v1.Token value) { - if (tokensBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTokensIsMutable(); - tokens_.add(index, value); - onChanged(); - } else { - tokensBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens(com.google.cloud.language.v1.Token.Builder builderForValue) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.add(builderForValue.build()); - onChanged(); - } else { - tokensBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addTokens( - int index, com.google.cloud.language.v1.Token.Builder builderForValue) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.add(index, builderForValue.build()); - onChanged(); - } else { - tokensBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder addAllTokens( - java.lang.Iterable values) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, tokens_); - onChanged(); - } else { - tokensBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder clearTokens() { - if (tokensBuilder_ == null) { - tokens_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - tokensBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public Builder removeTokens(int index) { - if (tokensBuilder_ == null) { - ensureTokensIsMutable(); - tokens_.remove(index); - onChanged(); - } else { - tokensBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token.Builder getTokensBuilder(int index) { - return getTokensFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index) { - if (tokensBuilder_ == null) { - return tokens_.get(index); - } else { - return tokensBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public java.util.List - getTokensOrBuilderList() { - if (tokensBuilder_ != null) { - return tokensBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(tokens_); - } - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token.Builder addTokensBuilder() { - return getTokensFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Token.getDefaultInstance()); - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public com.google.cloud.language.v1.Token.Builder addTokensBuilder(int index) { - return getTokensFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Token.getDefaultInstance()); - } - /** - * - * - *
-     * Tokens, along with their syntactic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-     * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - public java.util.List getTokensBuilderList() { - return getTokensFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Token, - com.google.cloud.language.v1.Token.Builder, - com.google.cloud.language.v1.TokenOrBuilder> - getTokensFieldBuilder() { - if (tokensBuilder_ == null) { - tokensBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Token, - com.google.cloud.language.v1.Token.Builder, - com.google.cloud.language.v1.TokenOrBuilder>( - tokens_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); - tokens_ = null; - } - return tokensBuilder_; - } - - private java.util.List entities_ = - java.util.Collections.emptyList(); - - private void ensureEntitiesIsMutable() { - if (!((bitField0_ & 0x00000004) != 0)) { - entities_ = new java.util.ArrayList(entities_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder> - entitiesBuilder_; - - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public java.util.List getEntitiesList() { - if (entitiesBuilder_ == null) { - return java.util.Collections.unmodifiableList(entities_); - } else { - return entitiesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public int getEntitiesCount() { - if (entitiesBuilder_ == null) { - return entities_.size(); - } else { - return entitiesBuilder_.getCount(); - } - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public com.google.cloud.language.v1.Entity getEntities(int index) { - if (entitiesBuilder_ == null) { - return entities_.get(index); - } else { - return entitiesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder setEntities(int index, com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.set(index, value); - onChanged(); - } else { - entitiesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder setEntities( - int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.set(index, builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder addEntities(com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.add(value); - onChanged(); - } else { - entitiesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder addEntities(int index, com.google.cloud.language.v1.Entity value) { - if (entitiesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEntitiesIsMutable(); - entities_.add(index, value); - onChanged(); - } else { - entitiesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder addEntities(com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder addEntities( - int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.add(index, builderForValue.build()); - onChanged(); - } else { - entitiesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder addAllEntities( - java.lang.Iterable values) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, entities_); - onChanged(); - } else { - entitiesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder clearEntities() { - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - entitiesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public Builder removeEntities(int index) { - if (entitiesBuilder_ == null) { - ensureEntitiesIsMutable(); - entities_.remove(index); - onChanged(); - } else { - entitiesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public com.google.cloud.language.v1.Entity.Builder getEntitiesBuilder(int index) { - return getEntitiesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { - if (entitiesBuilder_ == null) { - return entities_.get(index); - } else { - return entitiesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public java.util.List - getEntitiesOrBuilderList() { - if (entitiesBuilder_ != null) { - return entitiesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(entities_); - } - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder() { - return getEntitiesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.Entity.getDefaultInstance()); - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder(int index) { - return getEntitiesFieldBuilder() - .addBuilder(index, com.google.cloud.language.v1.Entity.getDefaultInstance()); - } - /** - * - * - *
-     * Entities, along with their semantic information, in the input document.
-     * Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-     * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - public java.util.List getEntitiesBuilderList() { - return getEntitiesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder> - getEntitiesFieldBuilder() { - if (entitiesBuilder_ == null) { - entitiesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.Entity, - com.google.cloud.language.v1.Entity.Builder, - com.google.cloud.language.v1.EntityOrBuilder>( - entities_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); - entities_ = null; - } - return entitiesBuilder_; - } - - private com.google.cloud.language.v1.Sentiment documentSentiment_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Sentiment, - com.google.cloud.language.v1.Sentiment.Builder, - com.google.cloud.language.v1.SentimentOrBuilder> - documentSentimentBuilder_; - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - * - * @return Whether the documentSentiment field is set. - */ - public boolean hasDocumentSentiment() { - return documentSentimentBuilder_ != null || documentSentiment_ != null; - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - * - * @return The documentSentiment. - */ - public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { - if (documentSentimentBuilder_ == null) { - return documentSentiment_ == null - ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() - : documentSentiment_; - } else { - return documentSentimentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - public Builder setDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { - if (documentSentimentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - documentSentiment_ = value; - onChanged(); - } else { - documentSentimentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - public Builder setDocumentSentiment( - com.google.cloud.language.v1.Sentiment.Builder builderForValue) { - if (documentSentimentBuilder_ == null) { - documentSentiment_ = builderForValue.build(); - onChanged(); - } else { - documentSentimentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - public Builder mergeDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { - if (documentSentimentBuilder_ == null) { - if (documentSentiment_ != null) { - documentSentiment_ = - com.google.cloud.language.v1.Sentiment.newBuilder(documentSentiment_) - .mergeFrom(value) - .buildPartial(); - } else { - documentSentiment_ = value; - } - onChanged(); - } else { - documentSentimentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - public Builder clearDocumentSentiment() { - if (documentSentimentBuilder_ == null) { - documentSentiment_ = null; - onChanged(); - } else { - documentSentiment_ = null; - documentSentimentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - public com.google.cloud.language.v1.Sentiment.Builder getDocumentSentimentBuilder() { - - onChanged(); - return getDocumentSentimentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { - if (documentSentimentBuilder_ != null) { - return documentSentimentBuilder_.getMessageOrBuilder(); - } else { - return documentSentiment_ == null - ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() - : documentSentiment_; - } - } - /** - * - * - *
-     * The overall sentiment for the document. Populated if the user enables
-     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Sentiment, - com.google.cloud.language.v1.Sentiment.Builder, - com.google.cloud.language.v1.SentimentOrBuilder> - getDocumentSentimentFieldBuilder() { - if (documentSentimentBuilder_ == null) { - documentSentimentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Sentiment, - com.google.cloud.language.v1.Sentiment.Builder, - com.google.cloud.language.v1.SentimentOrBuilder>( - getDocumentSentiment(), getParentForChildren(), isClean()); - documentSentiment_ = null; - } - return documentSentimentBuilder_; - } - - private java.lang.Object language_ = ""; - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 5; - * - * @return The language. - */ - public java.lang.String getLanguage() { - java.lang.Object ref = language_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - language_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 5; - * - * @return The bytes for language. - */ - public com.google.protobuf.ByteString getLanguageBytes() { - java.lang.Object ref = language_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - language_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 5; - * - * @param value The language to set. - * @return This builder for chaining. - */ - public Builder setLanguage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - language_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 5; - * - * @return This builder for chaining. - */ - public Builder clearLanguage() { - - language_ = getDefaultInstance().getLanguage(); - onChanged(); - return this; - } - /** - * - * - *
-     * The language of the text, which will be the same as the language specified
-     * in the request or, if not specified, the automatically-detected language.
-     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-     * 
- * - * string language = 5; - * - * @param value The bytes for language to set. - * @return This builder for chaining. - */ - public Builder setLanguageBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - language_ = value; - onChanged(); - return this; - } - - private java.util.List categories_ = - java.util.Collections.emptyList(); - - private void ensureCategoriesIsMutable() { - if (!((bitField0_ & 0x00000008) != 0)) { - categories_ = - new java.util.ArrayList( - categories_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.ClassificationCategory, - com.google.cloud.language.v1.ClassificationCategory.Builder, - com.google.cloud.language.v1.ClassificationCategoryOrBuilder> - categoriesBuilder_; - - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public java.util.List getCategoriesList() { - if (categoriesBuilder_ == null) { - return java.util.Collections.unmodifiableList(categories_); - } else { - return categoriesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public int getCategoriesCount() { - if (categoriesBuilder_ == null) { - return categories_.size(); - } else { - return categoriesBuilder_.getCount(); - } - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { - if (categoriesBuilder_ == null) { - return categories_.get(index); - } else { - return categoriesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder setCategories( - int index, com.google.cloud.language.v1.ClassificationCategory value) { - if (categoriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCategoriesIsMutable(); - categories_.set(index, value); - onChanged(); - } else { - categoriesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder setCategories( - int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.set(index, builderForValue.build()); - onChanged(); - } else { - categoriesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder addCategories(com.google.cloud.language.v1.ClassificationCategory value) { - if (categoriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCategoriesIsMutable(); - categories_.add(value); - onChanged(); - } else { - categoriesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder addCategories( - int index, com.google.cloud.language.v1.ClassificationCategory value) { - if (categoriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCategoriesIsMutable(); - categories_.add(index, value); - onChanged(); - } else { - categoriesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder addCategories( - com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.add(builderForValue.build()); - onChanged(); - } else { - categoriesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder addCategories( - int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.add(index, builderForValue.build()); - onChanged(); - } else { - categoriesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder addAllCategories( - java.lang.Iterable values) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, categories_); - onChanged(); - } else { - categoriesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder clearCategories() { - if (categoriesBuilder_ == null) { - categories_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - categoriesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public Builder removeCategories(int index) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.remove(index); - onChanged(); - } else { - categoriesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public com.google.cloud.language.v1.ClassificationCategory.Builder getCategoriesBuilder( - int index) { - return getCategoriesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( - int index) { - if (categoriesBuilder_ == null) { - return categories_.get(index); - } else { - return categoriesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public java.util.List - getCategoriesOrBuilderList() { - if (categoriesBuilder_ != null) { - return categoriesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(categories_); - } - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder() { - return getCategoriesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder( - int index) { - return getCategoriesFieldBuilder() - .addBuilder( - index, com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); - } - /** - * - * - *
-     * Categories identified in the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public java.util.List - getCategoriesBuilderList() { - return getCategoriesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.ClassificationCategory, - com.google.cloud.language.v1.ClassificationCategory.Builder, - com.google.cloud.language.v1.ClassificationCategoryOrBuilder> - getCategoriesFieldBuilder() { - if (categoriesBuilder_ == null) { - categoriesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.ClassificationCategory, - com.google.cloud.language.v1.ClassificationCategory.Builder, - com.google.cloud.language.v1.ClassificationCategoryOrBuilder>( - categories_, ((bitField0_ & 0x00000008) != 0), getParentForChildren(), isClean()); - categories_ = null; - } - return categoriesBuilder_; - } - - @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.language.v1.AnnotateTextResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnnotateTextResponse) - private static final com.google.cloud.language.v1.AnnotateTextResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnnotateTextResponse(); - } - - public static com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public AnnotateTextResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java deleted file mode 100644 index 42ca1b94..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface AnnotateTextResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnnotateTextResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - java.util.List getSentencesList(); - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - com.google.cloud.language.v1.Sentence getSentences(int index); - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - int getSentencesCount(); - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - java.util.List - getSentencesOrBuilderList(); - /** - * - * - *
-   * Sentences in the input document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index); - - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - java.util.List getTokensList(); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - com.google.cloud.language.v1.Token getTokens(int index); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - int getTokensCount(); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - java.util.List getTokensOrBuilderList(); - /** - * - * - *
-   * Tokens, along with their syntactic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
-   * 
- * - * repeated .google.cloud.language.v1.Token tokens = 2; - */ - com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index); - - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - java.util.List getEntitiesList(); - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - com.google.cloud.language.v1.Entity getEntities(int index); - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - int getEntitiesCount(); - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - java.util.List getEntitiesOrBuilderList(); - /** - * - * - *
-   * Entities, along with their semantic information, in the input document.
-   * Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 3; - */ - com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index); - - /** - * - * - *
-   * The overall sentiment for the document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - * - * @return Whether the documentSentiment field is set. - */ - boolean hasDocumentSentiment(); - /** - * - * - *
-   * The overall sentiment for the document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - * - * @return The documentSentiment. - */ - com.google.cloud.language.v1.Sentiment getDocumentSentiment(); - /** - * - * - *
-   * The overall sentiment for the document. Populated if the user enables
-   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 4; - */ - com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder(); - - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 5; - * - * @return The language. - */ - java.lang.String getLanguage(); - /** - * - * - *
-   * The language of the text, which will be the same as the language specified
-   * in the request or, if not specified, the automatically-detected language.
-   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
-   * 
- * - * string language = 5; - * - * @return The bytes for language. - */ - com.google.protobuf.ByteString getLanguageBytes(); - - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - java.util.List getCategoriesList(); - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - com.google.cloud.language.v1.ClassificationCategory getCategories(int index); - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - int getCategoriesCount(); - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - java.util.List - getCategoriesOrBuilderList(); - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder(int index); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java deleted file mode 100644 index 0d385a3e..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java +++ /dev/null @@ -1,718 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * Represents a category returned from the text classifier.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationCategory} - */ -public final class ClassificationCategory extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationCategory) - ClassificationCategoryOrBuilder { - private static final long serialVersionUID = 0L; - // Use ClassificationCategory.newBuilder() to construct. - private ClassificationCategory(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ClassificationCategory() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ClassificationCategory(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationCategory_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationCategory_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationCategory.class, - com.google.cloud.language.v1.ClassificationCategory.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * The name of the category representing the document, from the [predefined
-   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-   * 
- * - * string name = 1; - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * The name of the category representing the document, from the [predefined
-   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-   * 
- * - * string name = 1; - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int CONFIDENCE_FIELD_NUMBER = 2; - private float confidence_; - /** - * - * - *
-   * The classifier's confidence of the category. Number represents how certain
-   * the classifier is that this category represents the given text.
-   * 
- * - * float confidence = 2; - * - * @return The confidence. - */ - @java.lang.Override - public float getConfidence() { - return confidence_; - } - - 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { - output.writeFloat(2, confidence_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { - size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, confidence_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.ClassificationCategory)) { - return super.equals(obj); - } - com.google.cloud.language.v1.ClassificationCategory other = - (com.google.cloud.language.v1.ClassificationCategory) obj; - - if (!getName().equals(other.getName())) return false; - if (java.lang.Float.floatToIntBits(getConfidence()) - != java.lang.Float.floatToIntBits(other.getConfidence())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; - hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.ClassificationCategory parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationCategory 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.language.v1.ClassificationCategory parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationCategory 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.language.v1.ClassificationCategory parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationCategory parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.ClassificationCategory parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationCategory 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.language.v1.ClassificationCategory parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationCategory 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.language.v1.ClassificationCategory parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationCategory 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.language.v1.ClassificationCategory 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; - } - /** - * - * - *
-   * Represents a category returned from the text classifier.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationCategory} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationCategory) - com.google.cloud.language.v1.ClassificationCategoryOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationCategory_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationCategory_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationCategory.class, - com.google.cloud.language.v1.ClassificationCategory.Builder.class); - } - - // Construct using com.google.cloud.language.v1.ClassificationCategory.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - confidence_ = 0F; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationCategory_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategory getDefaultInstanceForType() { - return com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategory build() { - com.google.cloud.language.v1.ClassificationCategory result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategory buildPartial() { - com.google.cloud.language.v1.ClassificationCategory result = - new com.google.cloud.language.v1.ClassificationCategory(this); - result.name_ = name_; - result.confidence_ = confidence_; - 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.language.v1.ClassificationCategory) { - return mergeFrom((com.google.cloud.language.v1.ClassificationCategory) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.ClassificationCategory other) { - if (other == com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()) - return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (other.getConfidence() != 0F) { - setConfidence(other.getConfidence()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 21: - { - confidence_ = input.readFloat(); - - break; - } // case 21 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * The name of the category representing the document, from the [predefined
-     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-     * 
- * - * string name = 1; - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The name of the category representing the document, from the [predefined
-     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-     * 
- * - * string name = 1; - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The name of the category representing the document, from the [predefined
-     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-     * 
- * - * string name = 1; - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The name of the category representing the document, from the [predefined
-     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-     * 
- * - * string name = 1; - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * The name of the category representing the document, from the [predefined
-     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-     * 
- * - * string name = 1; - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private float confidence_; - /** - * - * - *
-     * The classifier's confidence of the category. Number represents how certain
-     * the classifier is that this category represents the given text.
-     * 
- * - * float confidence = 2; - * - * @return The confidence. - */ - @java.lang.Override - public float getConfidence() { - return confidence_; - } - /** - * - * - *
-     * The classifier's confidence of the category. Number represents how certain
-     * the classifier is that this category represents the given text.
-     * 
- * - * float confidence = 2; - * - * @param value The confidence to set. - * @return This builder for chaining. - */ - public Builder setConfidence(float value) { - - confidence_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The classifier's confidence of the category. Number represents how certain
-     * the classifier is that this category represents the given text.
-     * 
- * - * float confidence = 2; - * - * @return This builder for chaining. - */ - public Builder clearConfidence() { - - confidence_ = 0F; - 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.language.v1.ClassificationCategory) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationCategory) - private static final com.google.cloud.language.v1.ClassificationCategory DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationCategory(); - } - - public static com.google.cloud.language.v1.ClassificationCategory getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ClassificationCategory parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategory getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java deleted file mode 100644 index 1dd70380..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface ClassificationCategoryOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationCategory) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The name of the category representing the document, from the [predefined
-   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-   * 
- * - * string name = 1; - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * The name of the category representing the document, from the [predefined
-   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
-   * 
- * - * string name = 1; - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * The classifier's confidence of the category. Number represents how certain
-   * the classifier is that this category represents the given text.
-   * 
- * - * float confidence = 2; - * - * @return The confidence. - */ - float getConfidence(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptions.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptions.java deleted file mode 100644 index 3af41654..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptions.java +++ /dev/null @@ -1,2417 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * Model options available for classification requests.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions} - */ -public final class ClassificationModelOptions extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationModelOptions) - ClassificationModelOptionsOrBuilder { - private static final long serialVersionUID = 0L; - // Use ClassificationModelOptions.newBuilder() to construct. - private ClassificationModelOptions(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ClassificationModelOptions() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ClassificationModelOptions(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationModelOptions.class, - com.google.cloud.language.v1.ClassificationModelOptions.Builder.class); - } - - public interface V1ModelOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationModelOptions.V1Model) - com.google.protobuf.MessageOrBuilder {} - /** - * - * - *
-   * Options for the V1 model.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V1Model} - */ - public static final class V1Model extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationModelOptions.V1Model) - V1ModelOrBuilder { - private static final long serialVersionUID = 0L; - // Use V1Model.newBuilder() to construct. - private V1Model(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private V1Model() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new V1Model(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.class, - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder.class); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.ClassificationModelOptions.V1Model)) { - return super.equals(obj); - } - com.google.cloud.language.v1.ClassificationModelOptions.V1Model other = - (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) obj; - - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model 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.language.v1.ClassificationModelOptions.V1Model parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model 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.language.v1.ClassificationModelOptions.V1Model parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model 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.language.v1.ClassificationModelOptions.V1Model - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model - 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.language.v1.ClassificationModelOptions.V1Model parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model 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.language.v1.ClassificationModelOptions.V1Model 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; - } - /** - * - * - *
-     * Options for the V1 model.
-     * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V1Model} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationModelOptions.V1Model) - com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.class, - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder.class); - } - - // Construct using - // com.google.cloud.language.v1.ClassificationModelOptions.V1Model.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1Model - getDefaultInstanceForType() { - return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1Model build() { - com.google.cloud.language.v1.ClassificationModelOptions.V1Model result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1Model buildPartial() { - com.google.cloud.language.v1.ClassificationModelOptions.V1Model result = - new com.google.cloud.language.v1.ClassificationModelOptions.V1Model(this); - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, - java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.language.v1.ClassificationModelOptions.V1Model) { - return mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions.V1Model) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - com.google.cloud.language.v1.ClassificationModelOptions.V1Model other) { - if (other - == com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance()) - return this; - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - @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.language.v1.ClassificationModelOptions.V1Model) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationModelOptions.V1Model) - private static final com.google.cloud.language.v1.ClassificationModelOptions.V1Model - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationModelOptions.V1Model(); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public V1Model parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1Model - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public interface V2ModelOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationModelOptions.V2Model) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-     * The content categories used for classification.
-     * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @return The enum numeric value on the wire for contentCategoriesVersion. - */ - int getContentCategoriesVersionValue(); - /** - * - * - *
-     * The content categories used for classification.
-     * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @return The contentCategoriesVersion. - */ - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion - getContentCategoriesVersion(); - } - /** - * - * - *
-   * Options for the V2 model.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V2Model} - */ - public static final class V2Model extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationModelOptions.V2Model) - V2ModelOrBuilder { - private static final long serialVersionUID = 0L; - // Use V2Model.newBuilder() to construct. - private V2Model(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private V2Model() { - contentCategoriesVersion_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new V2Model(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.class, - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder.class); - } - - /** - * - * - *
-     * The content categories used for classification.
-     * 
- * - * Protobuf enum {@code - * google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion} - */ - public enum ContentCategoriesVersion implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-       * If `ContentCategoriesVersion` is not specified, this option will
-       * default to `V1`.
-       * 
- * - * CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; - */ - CONTENT_CATEGORIES_VERSION_UNSPECIFIED(0), - /** - * - * - *
-       * Legacy content categories of our initial launch in 2017.
-       * 
- * - * V1 = 1; - */ - V1(1), - /** - * - * - *
-       * Updated content categories in 2022.
-       * 
- * - * V2 = 2; - */ - V2(2), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-       * If `ContentCategoriesVersion` is not specified, this option will
-       * default to `V1`.
-       * 
- * - * CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; - */ - public static final int CONTENT_CATEGORIES_VERSION_UNSPECIFIED_VALUE = 0; - /** - * - * - *
-       * Legacy content categories of our initial launch in 2017.
-       * 
- * - * V1 = 1; - */ - public static final int V1_VALUE = 1; - /** - * - * - *
-       * Updated content categories in 2022.
-       * 
- * - * V2 = 2; - */ - public static final int V2_VALUE = 2; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ContentCategoriesVersion valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static ContentCategoriesVersion forNumber(int value) { - switch (value) { - case 0: - return CONTENT_CATEGORIES_VERSION_UNSPECIFIED; - case 1: - return V1; - case 2: - return V2; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public ContentCategoriesVersion findValueByNumber(int number) { - return ContentCategoriesVersion.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDescriptor() - .getEnumTypes() - .get(0); - } - - private static final ContentCategoriesVersion[] VALUES = values(); - - public static ContentCategoriesVersion valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private ContentCategoriesVersion(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion) - } - - public static final int CONTENT_CATEGORIES_VERSION_FIELD_NUMBER = 1; - private int contentCategoriesVersion_; - /** - * - * - *
-     * The content categories used for classification.
-     * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @return The enum numeric value on the wire for contentCategoriesVersion. - */ - @java.lang.Override - public int getContentCategoriesVersionValue() { - return contentCategoriesVersion_; - } - /** - * - * - *
-     * The content categories used for classification.
-     * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @return The contentCategoriesVersion. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion - getContentCategoriesVersion() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion - result = - com.google.cloud.language.v1.ClassificationModelOptions.V2Model - .ContentCategoriesVersion.valueOf(contentCategoriesVersion_); - return result == null - ? com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion - .UNRECOGNIZED - : result; - } - - 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 (contentCategoriesVersion_ - != com.google.cloud.language.v1.ClassificationModelOptions.V2Model - .ContentCategoriesVersion.CONTENT_CATEGORIES_VERSION_UNSPECIFIED - .getNumber()) { - output.writeEnum(1, contentCategoriesVersion_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (contentCategoriesVersion_ - != com.google.cloud.language.v1.ClassificationModelOptions.V2Model - .ContentCategoriesVersion.CONTENT_CATEGORIES_VERSION_UNSPECIFIED - .getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, contentCategoriesVersion_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.ClassificationModelOptions.V2Model)) { - return super.equals(obj); - } - com.google.cloud.language.v1.ClassificationModelOptions.V2Model other = - (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) obj; - - if (contentCategoriesVersion_ != other.contentCategoriesVersion_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + CONTENT_CATEGORIES_VERSION_FIELD_NUMBER; - hash = (53 * hash) + contentCategoriesVersion_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model 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.language.v1.ClassificationModelOptions.V2Model parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model 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.language.v1.ClassificationModelOptions.V2Model parseFrom( - byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model 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.language.v1.ClassificationModelOptions.V2Model - parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model - 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.language.v1.ClassificationModelOptions.V2Model parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model 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.language.v1.ClassificationModelOptions.V2Model 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; - } - /** - * - * - *
-     * Options for the V2 model.
-     * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V2Model} - */ - public static final class Builder - extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationModelOptions.V2Model) - com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.class, - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder.class); - } - - // Construct using - // com.google.cloud.language.v1.ClassificationModelOptions.V2Model.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - contentCategoriesVersion_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model - getDefaultInstanceForType() { - return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model build() { - com.google.cloud.language.v1.ClassificationModelOptions.V2Model result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model buildPartial() { - com.google.cloud.language.v1.ClassificationModelOptions.V2Model result = - new com.google.cloud.language.v1.ClassificationModelOptions.V2Model(this); - result.contentCategoriesVersion_ = contentCategoriesVersion_; - 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.language.v1.ClassificationModelOptions.V2Model) { - return mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions.V2Model) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom( - com.google.cloud.language.v1.ClassificationModelOptions.V2Model other) { - if (other - == com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance()) - return this; - if (other.contentCategoriesVersion_ != 0) { - setContentCategoriesVersionValue(other.getContentCategoriesVersionValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - contentCategoriesVersion_ = input.readEnum(); - - break; - } // case 8 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int contentCategoriesVersion_ = 0; - /** - * - * - *
-       * The content categories used for classification.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @return The enum numeric value on the wire for contentCategoriesVersion. - */ - @java.lang.Override - public int getContentCategoriesVersionValue() { - return contentCategoriesVersion_; - } - /** - * - * - *
-       * The content categories used for classification.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @param value The enum numeric value on the wire for contentCategoriesVersion to set. - * @return This builder for chaining. - */ - public Builder setContentCategoriesVersionValue(int value) { - - contentCategoriesVersion_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * The content categories used for classification.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @return The contentCategoriesVersion. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model - .ContentCategoriesVersion - getContentCategoriesVersion() { - @SuppressWarnings("deprecation") - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion - result = - com.google.cloud.language.v1.ClassificationModelOptions.V2Model - .ContentCategoriesVersion.valueOf(contentCategoriesVersion_); - return result == null - ? com.google.cloud.language.v1.ClassificationModelOptions.V2Model - .ContentCategoriesVersion.UNRECOGNIZED - : result; - } - /** - * - * - *
-       * The content categories used for classification.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @param value The contentCategoriesVersion to set. - * @return This builder for chaining. - */ - public Builder setContentCategoriesVersion( - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion - value) { - if (value == null) { - throw new NullPointerException(); - } - - contentCategoriesVersion_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-       * The content categories used for classification.
-       * 
- * - * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; - * - * - * @return This builder for chaining. - */ - public Builder clearContentCategoriesVersion() { - - contentCategoriesVersion_ = 0; - 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.language.v1.ClassificationModelOptions.V2Model) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationModelOptions.V2Model) - private static final com.google.cloud.language.v1.ClassificationModelOptions.V2Model - DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationModelOptions.V2Model(); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model - getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public V2Model parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException() - .setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model - getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - private int modelTypeCase_ = 0; - private java.lang.Object modelType_; - - public enum ModelTypeCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - V1_MODEL(1), - V2_MODEL(2), - MODELTYPE_NOT_SET(0); - private final int value; - - private ModelTypeCase(int value) { - this.value = value; - } - /** - * @param value The number of the enum to look for. - * @return The enum associated with the given number. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static ModelTypeCase valueOf(int value) { - return forNumber(value); - } - - public static ModelTypeCase forNumber(int value) { - switch (value) { - case 1: - return V1_MODEL; - case 2: - return V2_MODEL; - case 0: - return MODELTYPE_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public ModelTypeCase getModelTypeCase() { - return ModelTypeCase.forNumber(modelTypeCase_); - } - - public static final int V1_MODEL_FIELD_NUMBER = 1; - /** - * - * - *
-   * Setting this field will use the V1 model and V1 content categories
-   * version. The V1 model is a legacy model; support for this will be
-   * discontinued in the future.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - * - * @return Whether the v1Model field is set. - */ - @java.lang.Override - public boolean hasV1Model() { - return modelTypeCase_ == 1; - } - /** - * - * - *
-   * Setting this field will use the V1 model and V1 content categories
-   * version. The V1 model is a legacy model; support for this will be
-   * discontinued in the future.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - * - * @return The v1Model. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1Model getV1Model() { - if (modelTypeCase_ == 1) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); - } - /** - * - * - *
-   * Setting this field will use the V1 model and V1 content categories
-   * version. The V1 model is a legacy model; support for this will be
-   * discontinued in the future.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder - getV1ModelOrBuilder() { - if (modelTypeCase_ == 1) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); - } - - public static final int V2_MODEL_FIELD_NUMBER = 2; - /** - * - * - *
-   * Setting this field will use the V2 model with the appropriate content
-   * categories version. The V2 model is a better performing model.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - * - * @return Whether the v2Model field is set. - */ - @java.lang.Override - public boolean hasV2Model() { - return modelTypeCase_ == 2; - } - /** - * - * - *
-   * Setting this field will use the V2 model with the appropriate content
-   * categories version. The V2 model is a better performing model.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - * - * @return The v2Model. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model getV2Model() { - if (modelTypeCase_ == 2) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); - } - /** - * - * - *
-   * Setting this field will use the V2 model with the appropriate content
-   * categories version. The V2 model is a better performing model.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder - getV2ModelOrBuilder() { - if (modelTypeCase_ == 2) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); - } - - 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 (modelTypeCase_ == 1) { - output.writeMessage( - 1, (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_); - } - if (modelTypeCase_ == 2) { - output.writeMessage( - 2, (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (modelTypeCase_ == 1) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 1, (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_); - } - if (modelTypeCase_ == 2) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 2, (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.ClassificationModelOptions)) { - return super.equals(obj); - } - com.google.cloud.language.v1.ClassificationModelOptions other = - (com.google.cloud.language.v1.ClassificationModelOptions) obj; - - if (!getModelTypeCase().equals(other.getModelTypeCase())) return false; - switch (modelTypeCase_) { - case 1: - if (!getV1Model().equals(other.getV1Model())) return false; - break; - case 2: - if (!getV2Model().equals(other.getV2Model())) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - switch (modelTypeCase_) { - case 1: - hash = (37 * hash) + V1_MODEL_FIELD_NUMBER; - hash = (53 * hash) + getV1Model().hashCode(); - break; - case 2: - hash = (37 * hash) + V2_MODEL_FIELD_NUMBER; - hash = (53 * hash) + getV2Model().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions 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.language.v1.ClassificationModelOptions parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions 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.language.v1.ClassificationModelOptions parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions 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.language.v1.ClassificationModelOptions parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions 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.language.v1.ClassificationModelOptions parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions 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.language.v1.ClassificationModelOptions 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; - } - /** - * - * - *
-   * Model options available for classification requests.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationModelOptions) - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassificationModelOptions.class, - com.google.cloud.language.v1.ClassificationModelOptions.Builder.class); - } - - // Construct using com.google.cloud.language.v1.ClassificationModelOptions.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (v1ModelBuilder_ != null) { - v1ModelBuilder_.clear(); - } - if (v2ModelBuilder_ != null) { - v2ModelBuilder_.clear(); - } - modelTypeCase_ = 0; - modelType_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassificationModelOptions_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions getDefaultInstanceForType() { - return com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions build() { - com.google.cloud.language.v1.ClassificationModelOptions result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions buildPartial() { - com.google.cloud.language.v1.ClassificationModelOptions result = - new com.google.cloud.language.v1.ClassificationModelOptions(this); - if (modelTypeCase_ == 1) { - if (v1ModelBuilder_ == null) { - result.modelType_ = modelType_; - } else { - result.modelType_ = v1ModelBuilder_.build(); - } - } - if (modelTypeCase_ == 2) { - if (v2ModelBuilder_ == null) { - result.modelType_ = modelType_; - } else { - result.modelType_ = v2ModelBuilder_.build(); - } - } - result.modelTypeCase_ = modelTypeCase_; - 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.language.v1.ClassificationModelOptions) { - return mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.ClassificationModelOptions other) { - if (other == com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance()) - return this; - switch (other.getModelTypeCase()) { - case V1_MODEL: - { - mergeV1Model(other.getV1Model()); - break; - } - case V2_MODEL: - { - mergeV2Model(other.getV2Model()); - break; - } - case MODELTYPE_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getV1ModelFieldBuilder().getBuilder(), extensionRegistry); - modelTypeCase_ = 1; - break; - } // case 10 - case 18: - { - input.readMessage(getV2ModelFieldBuilder().getBuilder(), extensionRegistry); - modelTypeCase_ = 2; - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int modelTypeCase_ = 0; - private java.lang.Object modelType_; - - public ModelTypeCase getModelTypeCase() { - return ModelTypeCase.forNumber(modelTypeCase_); - } - - public Builder clearModelType() { - modelTypeCase_ = 0; - modelType_ = null; - onChanged(); - return this; - } - - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions.V1Model, - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder, - com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder> - v1ModelBuilder_; - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - * - * @return Whether the v1Model field is set. - */ - @java.lang.Override - public boolean hasV1Model() { - return modelTypeCase_ == 1; - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - * - * @return The v1Model. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1Model getV1Model() { - if (v1ModelBuilder_ == null) { - if (modelTypeCase_ == 1) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); - } else { - if (modelTypeCase_ == 1) { - return v1ModelBuilder_.getMessage(); - } - return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); - } - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - public Builder setV1Model( - com.google.cloud.language.v1.ClassificationModelOptions.V1Model value) { - if (v1ModelBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - modelType_ = value; - onChanged(); - } else { - v1ModelBuilder_.setMessage(value); - } - modelTypeCase_ = 1; - return this; - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - public Builder setV1Model( - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder builderForValue) { - if (v1ModelBuilder_ == null) { - modelType_ = builderForValue.build(); - onChanged(); - } else { - v1ModelBuilder_.setMessage(builderForValue.build()); - } - modelTypeCase_ = 1; - return this; - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - public Builder mergeV1Model( - com.google.cloud.language.v1.ClassificationModelOptions.V1Model value) { - if (v1ModelBuilder_ == null) { - if (modelTypeCase_ == 1 - && modelType_ - != com.google.cloud.language.v1.ClassificationModelOptions.V1Model - .getDefaultInstance()) { - modelType_ = - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.newBuilder( - (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_) - .mergeFrom(value) - .buildPartial(); - } else { - modelType_ = value; - } - onChanged(); - } else { - if (modelTypeCase_ == 1) { - v1ModelBuilder_.mergeFrom(value); - } else { - v1ModelBuilder_.setMessage(value); - } - } - modelTypeCase_ = 1; - return this; - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - public Builder clearV1Model() { - if (v1ModelBuilder_ == null) { - if (modelTypeCase_ == 1) { - modelTypeCase_ = 0; - modelType_ = null; - onChanged(); - } - } else { - if (modelTypeCase_ == 1) { - modelTypeCase_ = 0; - modelType_ = null; - } - v1ModelBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - public com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder - getV1ModelBuilder() { - return getV1ModelFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder - getV1ModelOrBuilder() { - if ((modelTypeCase_ == 1) && (v1ModelBuilder_ != null)) { - return v1ModelBuilder_.getMessageOrBuilder(); - } else { - if (modelTypeCase_ == 1) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); - } - } - /** - * - * - *
-     * Setting this field will use the V1 model and V1 content categories
-     * version. The V1 model is a legacy model; support for this will be
-     * discontinued in the future.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions.V1Model, - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder, - com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder> - getV1ModelFieldBuilder() { - if (v1ModelBuilder_ == null) { - if (!(modelTypeCase_ == 1)) { - modelType_ = - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); - } - v1ModelBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions.V1Model, - com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder, - com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder>( - (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_, - getParentForChildren(), - isClean()); - modelType_ = null; - } - modelTypeCase_ = 1; - onChanged(); - ; - return v1ModelBuilder_; - } - - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions.V2Model, - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder, - com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder> - v2ModelBuilder_; - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - * - * @return Whether the v2Model field is set. - */ - @java.lang.Override - public boolean hasV2Model() { - return modelTypeCase_ == 2; - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - * - * @return The v2Model. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model getV2Model() { - if (v2ModelBuilder_ == null) { - if (modelTypeCase_ == 2) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); - } else { - if (modelTypeCase_ == 2) { - return v2ModelBuilder_.getMessage(); - } - return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); - } - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - public Builder setV2Model( - com.google.cloud.language.v1.ClassificationModelOptions.V2Model value) { - if (v2ModelBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - modelType_ = value; - onChanged(); - } else { - v2ModelBuilder_.setMessage(value); - } - modelTypeCase_ = 2; - return this; - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - public Builder setV2Model( - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder builderForValue) { - if (v2ModelBuilder_ == null) { - modelType_ = builderForValue.build(); - onChanged(); - } else { - v2ModelBuilder_.setMessage(builderForValue.build()); - } - modelTypeCase_ = 2; - return this; - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - public Builder mergeV2Model( - com.google.cloud.language.v1.ClassificationModelOptions.V2Model value) { - if (v2ModelBuilder_ == null) { - if (modelTypeCase_ == 2 - && modelType_ - != com.google.cloud.language.v1.ClassificationModelOptions.V2Model - .getDefaultInstance()) { - modelType_ = - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.newBuilder( - (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_) - .mergeFrom(value) - .buildPartial(); - } else { - modelType_ = value; - } - onChanged(); - } else { - if (modelTypeCase_ == 2) { - v2ModelBuilder_.mergeFrom(value); - } else { - v2ModelBuilder_.setMessage(value); - } - } - modelTypeCase_ = 2; - return this; - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - public Builder clearV2Model() { - if (v2ModelBuilder_ == null) { - if (modelTypeCase_ == 2) { - modelTypeCase_ = 0; - modelType_ = null; - onChanged(); - } - } else { - if (modelTypeCase_ == 2) { - modelTypeCase_ = 0; - modelType_ = null; - } - v2ModelBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - public com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder - getV2ModelBuilder() { - return getV2ModelFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder - getV2ModelOrBuilder() { - if ((modelTypeCase_ == 2) && (v2ModelBuilder_ != null)) { - return v2ModelBuilder_.getMessageOrBuilder(); - } else { - if (modelTypeCase_ == 2) { - return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; - } - return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); - } - } - /** - * - * - *
-     * Setting this field will use the V2 model with the appropriate content
-     * categories version. The V2 model is a better performing model.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions.V2Model, - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder, - com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder> - getV2ModelFieldBuilder() { - if (v2ModelBuilder_ == null) { - if (!(modelTypeCase_ == 2)) { - modelType_ = - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); - } - v2ModelBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions.V2Model, - com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder, - com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder>( - (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_, - getParentForChildren(), - isClean()); - modelType_ = null; - } - modelTypeCase_ = 2; - onChanged(); - ; - return v2ModelBuilder_; - } - - @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.language.v1.ClassificationModelOptions) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationModelOptions) - private static final com.google.cloud.language.v1.ClassificationModelOptions DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationModelOptions(); - } - - public static com.google.cloud.language.v1.ClassificationModelOptions getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ClassificationModelOptions parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptionsOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptionsOrBuilder.java deleted file mode 100644 index 852a2579..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptionsOrBuilder.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface ClassificationModelOptionsOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationModelOptions) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Setting this field will use the V1 model and V1 content categories
-   * version. The V1 model is a legacy model; support for this will be
-   * discontinued in the future.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - * - * @return Whether the v1Model field is set. - */ - boolean hasV1Model(); - /** - * - * - *
-   * Setting this field will use the V1 model and V1 content categories
-   * version. The V1 model is a legacy model; support for this will be
-   * discontinued in the future.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - * - * @return The v1Model. - */ - com.google.cloud.language.v1.ClassificationModelOptions.V1Model getV1Model(); - /** - * - * - *
-   * Setting this field will use the V1 model and V1 content categories
-   * version. The V1 model is a legacy model; support for this will be
-   * discontinued in the future.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; - */ - com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder getV1ModelOrBuilder(); - - /** - * - * - *
-   * Setting this field will use the V2 model with the appropriate content
-   * categories version. The V2 model is a better performing model.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - * - * @return Whether the v2Model field is set. - */ - boolean hasV2Model(); - /** - * - * - *
-   * Setting this field will use the V2 model with the appropriate content
-   * categories version. The V2 model is a better performing model.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - * - * @return The v2Model. - */ - com.google.cloud.language.v1.ClassificationModelOptions.V2Model getV2Model(); - /** - * - * - *
-   * Setting this field will use the V2 model with the appropriate content
-   * categories version. The V2 model is a better performing model.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; - */ - com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder getV2ModelOrBuilder(); - - public com.google.cloud.language.v1.ClassificationModelOptions.ModelTypeCase getModelTypeCase(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java deleted file mode 100644 index ec488de6..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java +++ /dev/null @@ -1,1029 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The document classification request message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassifyTextRequest} - */ -public final class ClassifyTextRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassifyTextRequest) - ClassifyTextRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ClassifyTextRequest.newBuilder() to construct. - private ClassifyTextRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ClassifyTextRequest() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ClassifyTextRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassifyTextRequest.class, - com.google.cloud.language.v1.ClassifyTextRequest.Builder.class); - } - - public static final int DOCUMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Document document_; - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - @java.lang.Override - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - @java.lang.Override - public com.google.cloud.language.v1.Document getDocument() { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - return getDocument(); - } - - public static final int CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER = 3; - private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; - /** - * - * - *
-   * Model options to use for classification. Defaults to v1 options if not
-   * specified.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - * - * @return Whether the classificationModelOptions field is set. - */ - @java.lang.Override - public boolean hasClassificationModelOptions() { - return classificationModelOptions_ != null; - } - /** - * - * - *
-   * Model options to use for classification. Defaults to v1 options if not
-   * specified.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - * - * @return The classificationModelOptions. - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions() { - return classificationModelOptions_ == null - ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() - : classificationModelOptions_; - } - /** - * - * - *
-   * Model options to use for classification. Defaults to v1 options if not
-   * specified.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder - getClassificationModelOptionsOrBuilder() { - return getClassificationModelOptions(); - } - - 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 (document_ != null) { - output.writeMessage(1, getDocument()); - } - if (classificationModelOptions_ != null) { - output.writeMessage(3, getClassificationModelOptions()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (document_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDocument()); - } - if (classificationModelOptions_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 3, getClassificationModelOptions()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.ClassifyTextRequest)) { - return super.equals(obj); - } - com.google.cloud.language.v1.ClassifyTextRequest other = - (com.google.cloud.language.v1.ClassifyTextRequest) obj; - - if (hasDocument() != other.hasDocument()) return false; - if (hasDocument()) { - if (!getDocument().equals(other.getDocument())) return false; - } - if (hasClassificationModelOptions() != other.hasClassificationModelOptions()) return false; - if (hasClassificationModelOptions()) { - if (!getClassificationModelOptions().equals(other.getClassificationModelOptions())) - return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocument()) { - hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocument().hashCode(); - } - if (hasClassificationModelOptions()) { - hash = (37 * hash) + CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER; - hash = (53 * hash) + getClassificationModelOptions().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.ClassifyTextRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest 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.language.v1.ClassifyTextRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest 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.language.v1.ClassifyTextRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest 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.language.v1.ClassifyTextRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest 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.language.v1.ClassifyTextRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest 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.language.v1.ClassifyTextRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The document classification request message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassifyTextRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassifyTextRequest) - com.google.cloud.language.v1.ClassifyTextRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassifyTextRequest.class, - com.google.cloud.language.v1.ClassifyTextRequest.Builder.class); - } - - // Construct using com.google.cloud.language.v1.ClassifyTextRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentBuilder_ == null) { - document_ = null; - } else { - document_ = null; - documentBuilder_ = null; - } - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptions_ = null; - } else { - classificationModelOptions_ = null; - classificationModelOptionsBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextRequest getDefaultInstanceForType() { - return com.google.cloud.language.v1.ClassifyTextRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextRequest build() { - com.google.cloud.language.v1.ClassifyTextRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextRequest buildPartial() { - com.google.cloud.language.v1.ClassifyTextRequest result = - new com.google.cloud.language.v1.ClassifyTextRequest(this); - if (documentBuilder_ == null) { - result.document_ = document_; - } else { - result.document_ = documentBuilder_.build(); - } - if (classificationModelOptionsBuilder_ == null) { - result.classificationModelOptions_ = classificationModelOptions_; - } else { - result.classificationModelOptions_ = classificationModelOptionsBuilder_.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.language.v1.ClassifyTextRequest) { - return mergeFrom((com.google.cloud.language.v1.ClassifyTextRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.ClassifyTextRequest other) { - if (other == com.google.cloud.language.v1.ClassifyTextRequest.getDefaultInstance()) - return this; - if (other.hasDocument()) { - mergeDocument(other.getDocument()); - } - if (other.hasClassificationModelOptions()) { - mergeClassificationModelOptions(other.getClassificationModelOptions()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getDocumentFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 26: - { - input.readMessage( - getClassificationModelOptionsFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.language.v1.Document document_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - documentBuilder_; - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - public com.google.cloud.language.v1.Document getDocument() { - if (documentBuilder_ == null) { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } else { - return documentBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - document_ = value; - onChanged(); - } else { - documentBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDocument(com.google.cloud.language.v1.Document.Builder builderForValue) { - if (documentBuilder_ == null) { - document_ = builderForValue.build(); - onChanged(); - } else { - documentBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDocument(com.google.cloud.language.v1.Document value) { - if (documentBuilder_ == null) { - if (document_ != null) { - document_ = - com.google.cloud.language.v1.Document.newBuilder(document_) - .mergeFrom(value) - .buildPartial(); - } else { - document_ = value; - } - onChanged(); - } else { - documentBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDocument() { - if (documentBuilder_ == null) { - document_ = null; - onChanged(); - } else { - document_ = null; - documentBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { - - onChanged(); - return getDocumentFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { - if (documentBuilder_ != null) { - return documentBuilder_.getMessageOrBuilder(); - } else { - return document_ == null - ? com.google.cloud.language.v1.Document.getDefaultInstance() - : document_; - } - } - /** - * - * - *
-     * Required. Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder> - getDocumentFieldBuilder() { - if (documentBuilder_ == null) { - documentBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.Document, - com.google.cloud.language.v1.Document.Builder, - com.google.cloud.language.v1.DocumentOrBuilder>( - getDocument(), getParentForChildren(), isClean()); - document_ = null; - } - return documentBuilder_; - } - - private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions, - com.google.cloud.language.v1.ClassificationModelOptions.Builder, - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> - classificationModelOptionsBuilder_; - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - * - * @return Whether the classificationModelOptions field is set. - */ - public boolean hasClassificationModelOptions() { - return classificationModelOptionsBuilder_ != null || classificationModelOptions_ != null; - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - * - * @return The classificationModelOptions. - */ - public com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions() { - if (classificationModelOptionsBuilder_ == null) { - return classificationModelOptions_ == null - ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() - : classificationModelOptions_; - } else { - return classificationModelOptionsBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - public Builder setClassificationModelOptions( - com.google.cloud.language.v1.ClassificationModelOptions value) { - if (classificationModelOptionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - classificationModelOptions_ = value; - onChanged(); - } else { - classificationModelOptionsBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - public Builder setClassificationModelOptions( - com.google.cloud.language.v1.ClassificationModelOptions.Builder builderForValue) { - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptions_ = builderForValue.build(); - onChanged(); - } else { - classificationModelOptionsBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - public Builder mergeClassificationModelOptions( - com.google.cloud.language.v1.ClassificationModelOptions value) { - if (classificationModelOptionsBuilder_ == null) { - if (classificationModelOptions_ != null) { - classificationModelOptions_ = - com.google.cloud.language.v1.ClassificationModelOptions.newBuilder( - classificationModelOptions_) - .mergeFrom(value) - .buildPartial(); - } else { - classificationModelOptions_ = value; - } - onChanged(); - } else { - classificationModelOptionsBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - public Builder clearClassificationModelOptions() { - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptions_ = null; - onChanged(); - } else { - classificationModelOptions_ = null; - classificationModelOptionsBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - public com.google.cloud.language.v1.ClassificationModelOptions.Builder - getClassificationModelOptionsBuilder() { - - onChanged(); - return getClassificationModelOptionsFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder - getClassificationModelOptionsOrBuilder() { - if (classificationModelOptionsBuilder_ != null) { - return classificationModelOptionsBuilder_.getMessageOrBuilder(); - } else { - return classificationModelOptions_ == null - ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() - : classificationModelOptions_; - } - } - /** - * - * - *
-     * Model options to use for classification. Defaults to v1 options if not
-     * specified.
-     * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions, - com.google.cloud.language.v1.ClassificationModelOptions.Builder, - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> - getClassificationModelOptionsFieldBuilder() { - if (classificationModelOptionsBuilder_ == null) { - classificationModelOptionsBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.language.v1.ClassificationModelOptions, - com.google.cloud.language.v1.ClassificationModelOptions.Builder, - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder>( - getClassificationModelOptions(), getParentForChildren(), isClean()); - classificationModelOptions_ = null; - } - return classificationModelOptionsBuilder_; - } - - @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.language.v1.ClassifyTextRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassifyTextRequest) - private static final com.google.cloud.language.v1.ClassifyTextRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassifyTextRequest(); - } - - public static com.google.cloud.language.v1.ClassifyTextRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ClassifyTextRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java deleted file mode 100644 index 087944f5..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface ClassifyTextRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassifyTextRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Required. Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); - - /** - * - * - *
-   * Model options to use for classification. Defaults to v1 options if not
-   * specified.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - * - * @return Whether the classificationModelOptions field is set. - */ - boolean hasClassificationModelOptions(); - /** - * - * - *
-   * Model options to use for classification. Defaults to v1 options if not
-   * specified.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - * - * @return The classificationModelOptions. - */ - com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions(); - /** - * - * - *
-   * Model options to use for classification. Defaults to v1 options if not
-   * specified.
-   * 
- * - * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; - * - */ - com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder - getClassificationModelOptionsOrBuilder(); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java deleted file mode 100644 index 8b3d3f11..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java +++ /dev/null @@ -1,937 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * The document classification response message.
- * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassifyTextResponse} - */ -public final class ClassifyTextResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassifyTextResponse) - ClassifyTextResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use ClassifyTextResponse.newBuilder() to construct. - private ClassifyTextResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ClassifyTextResponse() { - categories_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ClassifyTextResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassifyTextResponse.class, - com.google.cloud.language.v1.ClassifyTextResponse.Builder.class); - } - - public static final int CATEGORIES_FIELD_NUMBER = 1; - private java.util.List categories_; - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - @java.lang.Override - public java.util.List getCategoriesList() { - return categories_; - } - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - @java.lang.Override - public java.util.List - getCategoriesOrBuilderList() { - return categories_; - } - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - @java.lang.Override - public int getCategoriesCount() { - return categories_.size(); - } - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { - return categories_.get(index); - } - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - @java.lang.Override - public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( - int index) { - return categories_.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 < categories_.size(); i++) { - output.writeMessage(1, categories_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < categories_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, categories_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.language.v1.ClassifyTextResponse)) { - return super.equals(obj); - } - com.google.cloud.language.v1.ClassifyTextResponse other = - (com.google.cloud.language.v1.ClassifyTextResponse) obj; - - if (!getCategoriesList().equals(other.getCategoriesList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getCategoriesCount() > 0) { - hash = (37 * hash) + CATEGORIES_FIELD_NUMBER; - hash = (53 * hash) + getCategoriesList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse 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.language.v1.ClassifyTextResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse 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.language.v1.ClassifyTextResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse 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.language.v1.ClassifyTextResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse 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.language.v1.ClassifyTextResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse 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.language.v1.ClassifyTextResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * The document classification response message.
-   * 
- * - * Protobuf type {@code google.cloud.language.v1.ClassifyTextResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassifyTextResponse) - com.google.cloud.language.v1.ClassifyTextResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.ClassifyTextResponse.class, - com.google.cloud.language.v1.ClassifyTextResponse.Builder.class); - } - - // Construct using com.google.cloud.language.v1.ClassifyTextResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (categoriesBuilder_ == null) { - categories_ = java.util.Collections.emptyList(); - } else { - categories_ = null; - categoriesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_ClassifyTextResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextResponse getDefaultInstanceForType() { - return com.google.cloud.language.v1.ClassifyTextResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextResponse build() { - com.google.cloud.language.v1.ClassifyTextResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextResponse buildPartial() { - com.google.cloud.language.v1.ClassifyTextResponse result = - new com.google.cloud.language.v1.ClassifyTextResponse(this); - int from_bitField0_ = bitField0_; - if (categoriesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - categories_ = java.util.Collections.unmodifiableList(categories_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.categories_ = categories_; - } else { - result.categories_ = categoriesBuilder_.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.language.v1.ClassifyTextResponse) { - return mergeFrom((com.google.cloud.language.v1.ClassifyTextResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.language.v1.ClassifyTextResponse other) { - if (other == com.google.cloud.language.v1.ClassifyTextResponse.getDefaultInstance()) - return this; - if (categoriesBuilder_ == null) { - if (!other.categories_.isEmpty()) { - if (categories_.isEmpty()) { - categories_ = other.categories_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureCategoriesIsMutable(); - categories_.addAll(other.categories_); - } - onChanged(); - } - } else { - if (!other.categories_.isEmpty()) { - if (categoriesBuilder_.isEmpty()) { - categoriesBuilder_.dispose(); - categoriesBuilder_ = null; - categories_ = other.categories_; - bitField0_ = (bitField0_ & ~0x00000001); - categoriesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getCategoriesFieldBuilder() - : null; - } else { - categoriesBuilder_.addAllMessages(other.categories_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.ClassificationCategory m = - input.readMessage( - com.google.cloud.language.v1.ClassificationCategory.parser(), - extensionRegistry); - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.add(m); - } else { - categoriesBuilder_.addMessage(m); - } - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List categories_ = - java.util.Collections.emptyList(); - - private void ensureCategoriesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - categories_ = - new java.util.ArrayList( - categories_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.ClassificationCategory, - com.google.cloud.language.v1.ClassificationCategory.Builder, - com.google.cloud.language.v1.ClassificationCategoryOrBuilder> - categoriesBuilder_; - - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public java.util.List getCategoriesList() { - if (categoriesBuilder_ == null) { - return java.util.Collections.unmodifiableList(categories_); - } else { - return categoriesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public int getCategoriesCount() { - if (categoriesBuilder_ == null) { - return categories_.size(); - } else { - return categoriesBuilder_.getCount(); - } - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { - if (categoriesBuilder_ == null) { - return categories_.get(index); - } else { - return categoriesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder setCategories( - int index, com.google.cloud.language.v1.ClassificationCategory value) { - if (categoriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCategoriesIsMutable(); - categories_.set(index, value); - onChanged(); - } else { - categoriesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder setCategories( - int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.set(index, builderForValue.build()); - onChanged(); - } else { - categoriesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder addCategories(com.google.cloud.language.v1.ClassificationCategory value) { - if (categoriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCategoriesIsMutable(); - categories_.add(value); - onChanged(); - } else { - categoriesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder addCategories( - int index, com.google.cloud.language.v1.ClassificationCategory value) { - if (categoriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCategoriesIsMutable(); - categories_.add(index, value); - onChanged(); - } else { - categoriesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder addCategories( - com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.add(builderForValue.build()); - onChanged(); - } else { - categoriesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder addCategories( - int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.add(index, builderForValue.build()); - onChanged(); - } else { - categoriesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder addAllCategories( - java.lang.Iterable values) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, categories_); - onChanged(); - } else { - categoriesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder clearCategories() { - if (categoriesBuilder_ == null) { - categories_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - categoriesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public Builder removeCategories(int index) { - if (categoriesBuilder_ == null) { - ensureCategoriesIsMutable(); - categories_.remove(index); - onChanged(); - } else { - categoriesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public com.google.cloud.language.v1.ClassificationCategory.Builder getCategoriesBuilder( - int index) { - return getCategoriesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( - int index) { - if (categoriesBuilder_ == null) { - return categories_.get(index); - } else { - return categoriesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public java.util.List - getCategoriesOrBuilderList() { - if (categoriesBuilder_ != null) { - return categoriesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(categories_); - } - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder() { - return getCategoriesFieldBuilder() - .addBuilder(com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder( - int index) { - return getCategoriesFieldBuilder() - .addBuilder( - index, com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); - } - /** - * - * - *
-     * Categories representing the input document.
-     * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public java.util.List - getCategoriesBuilderList() { - return getCategoriesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.ClassificationCategory, - com.google.cloud.language.v1.ClassificationCategory.Builder, - com.google.cloud.language.v1.ClassificationCategoryOrBuilder> - getCategoriesFieldBuilder() { - if (categoriesBuilder_ == null) { - categoriesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.language.v1.ClassificationCategory, - com.google.cloud.language.v1.ClassificationCategory.Builder, - com.google.cloud.language.v1.ClassificationCategoryOrBuilder>( - categories_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - categories_ = null; - } - return categoriesBuilder_; - } - - @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.language.v1.ClassifyTextResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassifyTextResponse) - private static final com.google.cloud.language.v1.ClassifyTextResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassifyTextResponse(); - } - - public static com.google.cloud.language.v1.ClassifyTextResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ClassifyTextResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.ClassifyTextResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java deleted file mode 100644 index f384274a..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -public interface ClassifyTextResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassifyTextResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - java.util.List getCategoriesList(); - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - com.google.cloud.language.v1.ClassificationCategory getCategories(int index); - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - int getCategoriesCount(); - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - java.util.List - getCategoriesOrBuilderList(); - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder(int index); -} diff --git a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java deleted file mode 100644 index d95c65d7..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java +++ /dev/null @@ -1,2615 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: google/cloud/language/v1/language_service.proto - -package com.google.cloud.language.v1; - -/** - * - * - *
- * Represents dependency parse tree information for a token. (For more
- * information on dependency labels, see
- * http://www.aclweb.org/anthology/P13-2017
- * 
- * - * Protobuf type {@code google.cloud.language.v1.DependencyEdge} - */ -public final class DependencyEdge extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.language.v1.DependencyEdge) - DependencyEdgeOrBuilder { - private static final long serialVersionUID = 0L; - // Use DependencyEdge.newBuilder() to construct. - private DependencyEdge(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private DependencyEdge() { - label_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DependencyEdge(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_DependencyEdge_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.language.v1.LanguageServiceProto - .internal_static_google_cloud_language_v1_DependencyEdge_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.language.v1.DependencyEdge.class, - com.google.cloud.language.v1.DependencyEdge.Builder.class); - } - - /** - * - * - *
-   * The parse label enum for the token.
-   * 
- * - * Protobuf enum {@code google.cloud.language.v1.DependencyEdge.Label} - */ - public enum Label implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-     * Unknown
-     * 
- * - * UNKNOWN = 0; - */ - UNKNOWN(0), - /** - * - * - *
-     * Abbreviation modifier
-     * 
- * - * ABBREV = 1; - */ - ABBREV(1), - /** - * - * - *
-     * Adjectival complement
-     * 
- * - * ACOMP = 2; - */ - ACOMP(2), - /** - * - * - *
-     * Adverbial clause modifier
-     * 
- * - * ADVCL = 3; - */ - ADVCL(3), - /** - * - * - *
-     * Adverbial modifier
-     * 
- * - * ADVMOD = 4; - */ - ADVMOD(4), - /** - * - * - *
-     * Adjectival modifier of an NP
-     * 
- * - * AMOD = 5; - */ - AMOD(5), - /** - * - * - *
-     * Appositional modifier of an NP
-     * 
- * - * APPOS = 6; - */ - APPOS(6), - /** - * - * - *
-     * Attribute dependent of a copular verb
-     * 
- * - * ATTR = 7; - */ - ATTR(7), - /** - * - * - *
-     * Auxiliary (non-main) verb
-     * 
- * - * AUX = 8; - */ - AUX(8), - /** - * - * - *
-     * Passive auxiliary
-     * 
- * - * AUXPASS = 9; - */ - AUXPASS(9), - /** - * - * - *
-     * Coordinating conjunction
-     * 
- * - * CC = 10; - */ - CC(10), - /** - * - * - *
-     * Clausal complement of a verb or adjective
-     * 
- * - * CCOMP = 11; - */ - CCOMP(11), - /** - * - * - *
-     * Conjunct
-     * 
- * - * CONJ = 12; - */ - CONJ(12), - /** - * - * - *
-     * Clausal subject
-     * 
- * - * CSUBJ = 13; - */ - CSUBJ(13), - /** - * - * - *
-     * Clausal passive subject
-     * 
- * - * CSUBJPASS = 14; - */ - CSUBJPASS(14), - /** - * - * - *
-     * Dependency (unable to determine)
-     * 
- * - * DEP = 15; - */ - DEP(15), - /** - * - * - *
-     * Determiner
-     * 
- * - * DET = 16; - */ - DET(16), - /** - * - * - *
-     * Discourse
-     * 
- * - * DISCOURSE = 17; - */ - DISCOURSE(17), - /** - * - * - *
-     * Direct object
-     * 
- * - * DOBJ = 18; - */ - DOBJ(18), - /** - * - * - *
-     * Expletive
-     * 
- * - * EXPL = 19; - */ - EXPL(19), - /** - * - * - *
-     * Goes with (part of a word in a text not well edited)
-     * 
- * - * GOESWITH = 20; - */ - GOESWITH(20), - /** - * - * - *
-     * Indirect object
-     * 
- * - * IOBJ = 21; - */ - IOBJ(21), - /** - * - * - *
-     * Marker (word introducing a subordinate clause)
-     * 
- * - * MARK = 22; - */ - MARK(22), - /** - * - * - *
-     * Multi-word expression
-     * 
- * - * MWE = 23; - */ - MWE(23), - /** - * - * - *
-     * Multi-word verbal expression
-     * 
- * - * MWV = 24; - */ - MWV(24), - /** - * - * - *
-     * Negation modifier
-     * 
- * - * NEG = 25; - */ - NEG(25), - /** - * - * - *
-     * Noun compound modifier
-     * 
- * - * NN = 26; - */ - NN(26), - /** - * - * - *
-     * Noun phrase used as an adverbial modifier
-     * 
- * - * NPADVMOD = 27; - */ - NPADVMOD(27), - /** - * - * - *
-     * Nominal subject
-     * 
- * - * NSUBJ = 28; - */ - NSUBJ(28), - /** - * - * - *
-     * Passive nominal subject
-     * 
- * - * NSUBJPASS = 29; - */ - NSUBJPASS(29), - /** - * - * - *
-     * Numeric modifier of a noun
-     * 
- * - * NUM = 30; - */ - NUM(30), - /** - * - * - *
-     * Element of compound number
-     * 
- * - * NUMBER = 31; - */ - NUMBER(31), - /** - * - * - *
-     * Punctuation mark
-     * 
- * - * P = 32; - */ - P(32), - /** - * - * - *
-     * Parataxis relation
-     * 
- * - * PARATAXIS = 33; - */ - PARATAXIS(33), - /** - * - * - *
-     * Participial modifier
-     * 
- * - * PARTMOD = 34; - */ - PARTMOD(34), - /** - * - * - *
-     * The complement of a preposition is a clause
-     * 
- * - * PCOMP = 35; - */ - PCOMP(35), - /** - * - * - *
-     * Object of a preposition
-     * 
- * - * POBJ = 36; - */ - POBJ(36), - /** - * - * - *
-     * Possession modifier
-     * 
- * - * POSS = 37; - */ - POSS(37), - /** - * - * - *
-     * Postverbal negative particle
-     * 
- * - * POSTNEG = 38; - */ - POSTNEG(38), - /** - * - * - *
-     * Predicate complement
-     * 
- * - * PRECOMP = 39; - */ - PRECOMP(39), - /** - * - * - *
-     * Preconjunt
-     * 
- * - * PRECONJ = 40; - */ - PRECONJ(40), - /** - * - * - *
-     * Predeterminer
-     * 
- * - * PREDET = 41; - */ - PREDET(41), - /** - * - * - *
-     * Prefix
-     * 
- * - * PREF = 42; - */ - PREF(42), - /** - * - * - *
-     * Prepositional modifier
-     * 
- * - * PREP = 43; - */ - PREP(43), - /** - * - * - *
-     * The relationship between a verb and verbal morpheme
-     * 
- * - * PRONL = 44; - */ - PRONL(44), - /** - * - * - *
-     * Particle
-     * 
- * - * PRT = 45; - */ - PRT(45), - /** - * - * - *
-     * Associative or possessive marker
-     * 
- * - * PS = 46; - */ - PS(46), - /** - * - * - *
-     * Quantifier phrase modifier
-     * 
- * - * QUANTMOD = 47; - */ - QUANTMOD(47), - /** - * - * - *
-     * Relative clause modifier
-     * 
- * - * RCMOD = 48; - */ - RCMOD(48), - /** - * - * - *
-     * Complementizer in relative clause
-     * 
- * - * RCMODREL = 49; - */ - RCMODREL(49), - /** - * - * - *
-     * Ellipsis without a preceding predicate
-     * 
- * - * RDROP = 50; - */ - RDROP(50), - /** - * - * - *
-     * Referent
-     * 
- * - * REF = 51; - */ - REF(51), - /** - * - * - *
-     * Remnant
-     * 
- * - * REMNANT = 52; - */ - REMNANT(52), - /** - * - * - *
-     * Reparandum
-     * 
- * - * REPARANDUM = 53; - */ - REPARANDUM(53), - /** - * - * - *
-     * Root
-     * 
- * - * ROOT = 54; - */ - ROOT(54), - /** - * - * - *
-     * Suffix specifying a unit of number
-     * 
- * - * SNUM = 55; - */ - SNUM(55), - /** - * - * - *
-     * Suffix
-     * 
- * - * SUFF = 56; - */ - SUFF(56), - /** - * - * - *
-     * Temporal modifier
-     * 
- * - * TMOD = 57; - */ - TMOD(57), - /** - * - * - *
-     * Topic marker
-     * 
- * - * TOPIC = 58; - */ - TOPIC(58), - /** - * - * - *
-     * Clause headed by an infinite form of the verb that modifies a noun
-     * 
- * - * VMOD = 59; - */ - VMOD(59), - /** - * - * - *
-     * Vocative
-     * 
- * - * VOCATIVE = 60; - */ - VOCATIVE(60), - /** - * - * - *
-     * Open clausal complement
-     * 
- * - * XCOMP = 61; - */ - XCOMP(61), - /** - * - * - *
-     * Name suffix
-     * 
- * - * SUFFIX = 62; - */ - SUFFIX(62), - /** - * - * - *
-     * Name title
-     * 
- * - * TITLE = 63; - */ - TITLE(63), - /** - * - * - *
-     * Adverbial phrase modifier
-     * 
- * - * ADVPHMOD = 64; - */ - ADVPHMOD(64), - /** - * - * - *
-     * Causative auxiliary
-     * 
- * - * AUXCAUS = 65; - */ - AUXCAUS(65), - /** - * - * - *
-     * Helper auxiliary
-     * 
- * - * AUXVV = 66; - */ - AUXVV(66), - /** - * - * - *
-     * Rentaishi (Prenominal modifier)
-     * 
- * - * DTMOD = 67; - */ - DTMOD(67), - /** - * - * - *
-     * Foreign words
-     * 
- * - * FOREIGN = 68; - */ - FOREIGN(68), - /** - * - * - *
-     * Keyword
-     * 
- * - * KW = 69; - */ - KW(69), - /** - * - * - *
-     * List for chains of comparable items
-     * 
- * - * LIST = 70; - */ - LIST(70), - /** - * - * - *
-     * Nominalized clause
-     * 
- * - * NOMC = 71; - */ - NOMC(71), - /** - * - * - *
-     * Nominalized clausal subject
-     * 
- * - * NOMCSUBJ = 72; - */ - NOMCSUBJ(72), - /** - * - * - *
-     * Nominalized clausal passive
-     * 
- * - * NOMCSUBJPASS = 73; - */ - NOMCSUBJPASS(73), - /** - * - * - *
-     * Compound of numeric modifier
-     * 
- * - * NUMC = 74; - */ - NUMC(74), - /** - * - * - *
-     * Copula
-     * 
- * - * COP = 75; - */ - COP(75), - /** - * - * - *
-     * Dislocated relation (for fronted/topicalized elements)
-     * 
- * - * DISLOCATED = 76; - */ - DISLOCATED(76), - /** - * - * - *
-     * Aspect marker
-     * 
- * - * ASP = 77; - */ - ASP(77), - /** - * - * - *
-     * Genitive modifier
-     * 
- * - * GMOD = 78; - */ - GMOD(78), - /** - * - * - *
-     * Genitive object
-     * 
- * - * GOBJ = 79; - */ - GOBJ(79), - /** - * - * - *
-     * Infinitival modifier
-     * 
- * - * INFMOD = 80; - */ - INFMOD(80), - /** - * - * - *
-     * Measure
-     * 
- * - * MES = 81; - */ - MES(81), - /** - * - * - *
-     * Nominal complement of a noun
-     * 
- * - * NCOMP = 82; - */ - NCOMP(82), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-     * Unknown
-     * 
- * - * UNKNOWN = 0; - */ - public static final int UNKNOWN_VALUE = 0; - /** - * - * - *
-     * Abbreviation modifier
-     * 
- * - * ABBREV = 1; - */ - public static final int ABBREV_VALUE = 1; - /** - * - * - *
-     * Adjectival complement
-     * 
- * - * ACOMP = 2; - */ - public static final int ACOMP_VALUE = 2; - /** - * - * - *
-     * Adverbial clause modifier
-     * 
- * - * ADVCL = 3; - */ - public static final int ADVCL_VALUE = 3; - /** - * - * - *
-     * Adverbial modifier
-     * 
- * - * ADVMOD = 4; - */ - public static final int ADVMOD_VALUE = 4; - /** - * - * - *
-     * Adjectival modifier of an NP
-     * 
- * - * AMOD = 5; - */ - public static final int AMOD_VALUE = 5; - /** - * - * - *
-     * Appositional modifier of an NP
-     * 
- * - * APPOS = 6; - */ - public static final int APPOS_VALUE = 6; - /** - * - * - *
-     * Attribute dependent of a copular verb
-     * 
- * - * ATTR = 7; - */ - public static final int ATTR_VALUE = 7; - /** - * - * - *
-     * Auxiliary (non-main) verb
-     * 
- * - * AUX = 8; - */ - public static final int AUX_VALUE = 8; - /** - * - * - *
-     * Passive auxiliary
-     * 
- * - * AUXPASS = 9; - */ - public static final int AUXPASS_VALUE = 9; - /** - * - * - *
-     * Coordinating conjunction
-     * 
- * - * CC = 10; - */ - public static final int CC_VALUE = 10; - /** - * - * - *
-     * Clausal complement of a verb or adjective
-     * 
- * - * CCOMP = 11; - */ - public static final int CCOMP_VALUE = 11; - /** - * - * - *
-     * Conjunct
-     * 
- * - * CONJ = 12; - */ - public static final int CONJ_VALUE = 12; - /** - * - * - *
-     * Clausal subject
-     * 
- * - * CSUBJ = 13; - */ - public static final int CSUBJ_VALUE = 13; - /** - * - * - *
-     * Clausal passive subject
-     * 
- * - * CSUBJPASS = 14; - */ - public static final int CSUBJPASS_VALUE = 14; - /** - * - * - *
-     * Dependency (unable to determine)
-     * 
- * - * DEP = 15; - */ - public static final int DEP_VALUE = 15; - /** - * - * - *
-     * Determiner
-     * 
- * - * DET = 16; - */ - public static final int DET_VALUE = 16; - /** - * - * - *
-     * Discourse
-     * 
- * - * DISCOURSE = 17; - */ - public static final int DISCOURSE_VALUE = 17; - /** - * - * - *
-     * Direct object
-     * 
- * - * DOBJ = 18; - */ - public static final int DOBJ_VALUE = 18; - /** - * - * - *
-     * Expletive
-     * 
- * - * EXPL = 19; - */ - public static final int EXPL_VALUE = 19; - /** - * - * - *
-     * Goes with (part of a word in a text not well edited)
-     * 
- * - * GOESWITH = 20; - */ - public static final int GOESWITH_VALUE = 20; - /** - * - * - *
-     * Indirect object
-     * 
- * - * IOBJ = 21; - */ - public static final int IOBJ_VALUE = 21; - /** - * - * - *
-     * Marker (word introducing a subordinate clause)
-     * 
- * - * MARK = 22; - */ - public static final int MARK_VALUE = 22; - /** - * - * - *
-     * Multi-word expression
-     * 
- * - * MWE = 23; - */ - public static final int MWE_VALUE = 23; - /** - * - * - *
-     * Multi-word verbal expression
-     * 
- * - * MWV = 24; - */ - public static final int MWV_VALUE = 24; - /** - * - * - *
-     * Negation modifier
-     * 
- * - * NEG = 25; - */ - public static final int NEG_VALUE = 25; - /** - * - * - *
-     * Noun compound modifier
-     * 
- * - * NN = 26; - */ - public static final int NN_VALUE = 26; - /** - * - * - *
-     * Noun phrase used as an adverbial modifier
-     * 
- * - * NPADVMOD = 27; - */ - public static final int NPADVMOD_VALUE = 27; - /** - * - * - *
-     * Nominal subject
-     * 
- * - * NSUBJ = 28; - */ - public static final int NSUBJ_VALUE = 28; - /** - * - * - *
-     * Passive nominal subject
-     * 
- * - * NSUBJPASS = 29; - */ - public static final int NSUBJPASS_VALUE = 29; - /** - * - * - *
-     * Numeric modifier of a noun
-     * 
- * - * NUM = 30; - */ - public static final int NUM_VALUE = 30; - /** - * - * - *
-     * Element of compound number
-     * 
- * - * NUMBER = 31; - */ - public static final int NUMBER_VALUE = 31; - /** - * - * - *
-     * Punctuation mark
-     * 
- * - * P = 32; - */ - public static final int P_VALUE = 32; - /** - * - * - *
-     * Parataxis relation
-     * 
- * - * PARATAXIS = 33; - */ - public static final int PARATAXIS_VALUE = 33; - /** - * - * - *
-     * Participial modifier
-     * 
- * - * PARTMOD = 34; - */ - public static final int PARTMOD_VALUE = 34; - /** - * - * - *
-     * The complement of a preposition is a clause
-     * 
- * - * PCOMP = 35; - */ - public static final int PCOMP_VALUE = 35; - /** - * - * - *
-     * Object of a preposition
-     * 
- * - * POBJ = 36; - */ - public static final int POBJ_VALUE = 36; - /** - * - * - *
-     * Possession modifier
-     * 
- * - * POSS = 37; - */ - public static final int POSS_VALUE = 37; - /** - * - * - *
-     * Postverbal negative particle
-     * 
- * - * POSTNEG = 38; - */ - public static final int POSTNEG_VALUE = 38; - /** - * - * - *
-     * Predicate complement
-     * 
- * - * PRECOMP = 39; - */ - public static final int PRECOMP_VALUE = 39; - /** - * - * - *
-     * Preconjunt
-     * 
- * - * PRECONJ = 40; - */ - public static final int PRECONJ_VALUE = 40; - /** - * - * - *
-     * Predeterminer
-     * 
- * - * PREDET = 41; - */ - public static final int PREDET_VALUE = 41; - /** - * - * - *
-     * Prefix
-     * 
- * - * PREF = 42; - */ - public static final int PREF_VALUE = 42; - /** - * - * - *
-     * Prepositional modifier
-     * 
- * - * PREP = 43; - */ - public static final int PREP_VALUE = 43; - /** - * - * - *
-     * The relationship between a verb and verbal morpheme
-     * 
- * - * PRONL = 44; - */ - public static final int PRONL_VALUE = 44; - /** - * - * - *
-     * Particle
-     * 
- * - * PRT = 45; - */ - public static final int PRT_VALUE = 45; - /** - * - * - *
-     * Associative or possessive marker
-     * 
- * - * PS = 46; - */ - public static final int PS_VALUE = 46; - /** - * - * - *
-     * Quantifier phrase modifier
-     * 
- * - * QUANTMOD = 47; - */ - public static final int QUANTMOD_VALUE = 47; - /** - * - * - *
-     * Relative clause modifier
-     * 
- * - * RCMOD = 48; - */ - public static final int RCMOD_VALUE = 48; - /** - * - * - *
-     * Complementizer in relative clause
-     * 
- * - * RCMODREL = 49; - */ - public static final int RCMODREL_VALUE = 49; - /** - * - * - *
-     * Ellipsis without a preceding predicate
-     * 
- * - * RDROP = 50; - */ - public static final int RDROP_VALUE = 50; - /** - * - * - *
-     * Referent
-     * 
- * - * REF = 51; - */ - public static final int REF_VALUE = 51; - /** - * - * - *
-     * Remnant
-     * 
- * - * REMNANT = 52; - */ - public static final int REMNANT_VALUE = 52; - /** - * - * - *
-     * Reparandum
-     * 
- * - * REPARANDUM = 53; - */ - public static final int REPARANDUM_VALUE = 53; - /** - * - * - *
-     * Root
-     * 
- * - * ROOT = 54; - */ - public static final int ROOT_VALUE = 54; - /** - * - * - *
-     * Suffix specifying a unit of number
-     * 
- * - * SNUM = 55; - */ - public static final int SNUM_VALUE = 55; - /** - * - * - *
-     * Suffix
-     * 
- * - * SUFF = 56; - */ - public static final int SUFF_VALUE = 56; - /** - * - * - *
-     * Temporal modifier
-     * 
- * - * TMOD = 57; - */ - public static final int TMOD_VALUE = 57; - /** - * - * - *
-     * Topic marker
-     * 
- * - * TOPIC = 58; - */ - public static final int TOPIC_VALUE = 58; - /** - * - * - *
-     * Clause headed by an infinite form of the verb that modifies a noun
-     * 
- * - * VMOD = 59; - */ - public static final int VMOD_VALUE = 59; - /** - * - * - *
-     * Vocative
-     * 
- * - * VOCATIVE = 60; - */ - public static final int VOCATIVE_VALUE = 60; - /** - * - * - *
-     * Open clausal complement
-     * 
- * - * XCOMP = 61; - */ - public static final int XCOMP_VALUE = 61; - /** - * - * - *
-     * Name suffix
-     * 
- * - * SUFFIX = 62; - */ - public static final int SUFFIX_VALUE = 62; - /** - * - * - *
-     * Name title
-     * 
- * - * TITLE = 63; - */ - public static final int TITLE_VALUE = 63; - /** - * - * - *
-     * Adverbial phrase modifier
-     * 
- * - * ADVPHMOD = 64; - */ - public static final int ADVPHMOD_VALUE = 64; - /** - * - * - *
-     * Causative auxiliary
-     * 
- * - * AUXCAUS = 65; - */ - public static final int AUXCAUS_VALUE = 65; - /** - * - * - *
-     * Helper auxiliary
-     * 
- * - * AUXVV = 66; - */ - public static final int AUXVV_VALUE = 66; - /** - * - * - *
-     * Rentaishi (Prenominal modifier)
-     * 
- * - * DTMOD = 67; - */ - public static final int DTMOD_VALUE = 67; - /** - * - * - *
-     * Foreign words
-     * 
- * - * FOREIGN = 68; - */ - public static final int FOREIGN_VALUE = 68; - /** - * - * - *
-     * Keyword
-     * 
- * - * KW = 69; - */ - public static final int KW_VALUE = 69; - /** - * - * - *
-     * List for chains of comparable items
-     * 
- * - * LIST = 70; - */ - public static final int LIST_VALUE = 70; - /** - * - * - *
-     * Nominalized clause
-     * 
- * - * NOMC = 71; - */ - public static final int NOMC_VALUE = 71; - /** - * - * - *
-     * Nominalized clausal subject
-     * 
- * - * NOMCSUBJ = 72; - */ - public static final int NOMCSUBJ_VALUE = 72; - /** - * - * - *
-     * Nominalized clausal passive
-     * 
- * - * NOMCSUBJPASS = 73; - */ - public static final int NOMCSUBJPASS_VALUE = 73; - /** - * - * - *
-     * Compound of numeric modifier
-     * 
- * - * NUMC = 74; - */ - public static final int NUMC_VALUE = 74; - /** - * - * - *
-     * Copula
-     * 
- * - * COP = 75; - */ - public static final int COP_VALUE = 75; - /** - * - * - *
-     * Dislocated relation (for fronted/topicalized elements)
-     * 
- * - * DISLOCATED = 76; - */ - public static final int DISLOCATED_VALUE = 76; - /** - * - * - *
-     * Aspect marker
-     * 
- * - * ASP = 77; - */ - public static final int ASP_VALUE = 77; - /** - * - * - *
-     * Genitive modifier
-     * 
- * - * GMOD = 78; - */ - public static final int GMOD_VALUE = 78; - /** - * - * - *
-     * Genitive object
-     * 
- * - * GOBJ = 79; - */ - public static final int GOBJ_VALUE = 79; - /** - * - * - *
-     * Infinitival modifier
-     * 
- * - * INFMOD = 80; - */ - public static final int INFMOD_VALUE = 80; - /** - * - * - *
-     * Measure
-     * 
- * - * MES = 81; - */ - public static final int MES_VALUE = 81; - /** - * - * - *
-     * Nominal complement of a noun
-     * 
- * - * NCOMP = 82; - */ - public static final int NCOMP_VALUE = 82; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static Label valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static Label forNumber(int value) { - switch (value) { - case 0: - return UNKNOWN; - case 1: - return ABBREV; - case 2: - return ACOMP; - case 3: - return ADVCL; - case 4: - return ADVMOD; - case 5: - return AMOD; - case 6: - return APPOS; - case 7: - return ATTR; - case 8: - return AUX; - case 9: - return AUXPASS; - case 10: - return CC; - case 11: - return CCOMP; - case 12: - return CONJ; - case 13: - return CSUBJ; - case 14: - return CSUBJPASS; - case 15: - return DEP; - case 16: - return DET; - case 17: - return DISCOURSE; - case 18: - return DOBJ; - case 19: - return EXPL; - case 20: - return GOESWITH; - case 21: - return IOBJ; - case 22: - return MARK; - case 23: - return MWE; - case 24: - return MWV; - case 25: - return NEG; - case 26: - return NN; - case 27: - return NPADVMOD; - case 28: - return NSUBJ; - case 29: - return NSUBJPASS; - case 30: - return NUM; - case 31: - return NUMBER; - case 32: - return P; - case 33: - return PARATAXIS; - case 34: - return PARTMOD; - case 35: - return PCOMP; - case 36: - return POBJ; - case 37: - return POSS; - case 38: - return POSTNEG; - case 39: - return PRECOMP; - case 40: - return PRECONJ; - case 41: - return PREDET; - case 42: - return PREF; - case 43: - return PREP; - case 44: - return PRONL; - case 45: - return PRT; - case 46: - return PS; - case 47: - return QUANTMOD; - case 48: - return RCMOD; - case 49: - return RCMODREL; - case 50: - return RDROP; - case 51: - return REF; - case 52: - return REMNANT; - case 53: - return REPARANDUM; - case 54: - return ROOT; - case 55: - return SNUM; - case 56: - return SUFF; - case 57: - return TMOD; - case 58: - return TOPIC; - case 59: - return VMOD; - case 60: - return VOCATIVE; - case 61: - return XCOMP; - case 62: - return SUFFIX; - case 63: - return TITLE; - case 64: - return ADVPHMOD; - case 65: - return AUXCAUS; - case 66: - return AUXVV; - case 67: - return DTMOD; - case 68: - return FOREIGN; - case 69: - return KW; - case 70: - return LIST; - case 71: - return NOMC; - case 72: - return NOMCSUBJ; - case 73: - return NOMCSUBJPASS; - case 74: - return NUMC; - case 75: - return COP; - case 76: - return DISLOCATED; - case 77: - return ASP; - case 78: - return GMOD; - case 79: - return GOBJ; - case 80: - return INFMOD; - case 81: - return MES; - case 82: - return NCOMP; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap