diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 30fdb7b9..00000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,10 +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 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 0ad6e053..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve - ---- - -Thanks for stopping by to let us know something could be better! - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. - -Please run down the following list and make sure you've tried the usual "quick fixes": - - - Search the issues already opened: https://github.com/googleapis/java-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. language 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 754e30c6..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this library - ---- - -Thanks for stopping by to let us know something could be better! - -**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. - -**Is your feature request related to a problem? Please describe.** -What the problem is. Example: I'm always frustrated when [...] - -**Describe the solution you'd like** -What you want to happen. - -**Describe alternatives you've considered** -Any alternative solutions or features you've considered. - -**Additional context** -Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md 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 37ee3a8f..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,7 +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 # ☕️ diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml deleted file mode 100644 index 1a23ea42..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/master/packages/blunderbuss -assign_prs_by: -- labels: - - samples - to: - - googleapis/java-samples-reviewers \ 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 47c2ba13..00000000 --- a/.github/generated-files-bot.yml +++ /dev/null @@ -1,11 +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]' diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata deleted file mode 100644 index b1e5fc1a..00000000 --- a/.github/readme/synth.metadata/synth.metadata +++ /dev/null @@ -1,18 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/java-language.git", - "sha": "2ed3bde1222ec307cc2fc80bca7d2fd7349afd4c" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "2414b817065726eae0bc525346c7e874f969369d" - } - } - ] -} \ No newline at end of file diff --git a/.github/readme/synth.py b/.github/readme/synth.py deleted file mode 100644 index 7b48cc28..00000000 --- a/.github/readme/synth.py +++ /dev/null @@ -1,19 +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 -# -# 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 is used to synthesize generated the README for this library.""" - -from synthtool.languages import java - -java.custom_templates(["java_library/README.md"]) diff --git a/.github/release-please.yml b/.github/release-please.yml index dce2c845..7bf58076 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,8 @@ +bumpMinorPreMajor: true +handleGHRelease: true releaseType: java-yoshi -bumpMinorPreMajor: true \ No newline at end of file +branches: + - bumpMinorPreMajor: true + handleGHRelease: true + releaseType: java-yoshi + branch: java7 diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 00000000..46c556a2 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1,2 @@ +enabled: true +multiScmName: java-language 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 6bddd18e..00000000 --- a/.github/sync-repo-settings.yaml +++ /dev/null @@ -1,49 +0,0 @@ - -# Whether or not rebase-merging is enabled on this repository. -# Defaults to `true` -rebaseMergeAllowed: false - -# Whether or not squash-merging is enabled on this repository. -# Defaults to `true` -squashMergeAllowed: true - -# Whether or not PRs are merged with a merge commit on this repository. -# Defaults to `false` -mergeCommitAllowed: false - -# Rules for master branch protection -branchProtectionRules: -# Identifies the protection rule pattern. Name of the branch to be protected. -# Defaults to `master` -- pattern: master - # Can admins overwrite branch protection. - # Defaults to `true` - isAdminEnforced: true - # Number of approving reviews required to update matching branches. - # Defaults to `1` - requiredApprovingReviewCount: 1 - # Are reviews from code owners required to update matching branches. - # Defaults to `false` - requiresCodeOwnerReviews: true - # Require up to date branches - requiresStrictStatusChecks: false - # List of required status check contexts that must pass for commits to be accepted to matching branches. - requiredStatusCheckContexts: - - "dependencies (8)" - - "dependencies (11)" - - "linkage-monitor" - - "lint" - - "clirr" - - "units (7)" - - "units (8)" - - "units (11)" - - "Kokoro - Test: Integration" - - "cla/google" -# List of explicit permissions to add (additive only) -permissionRules: -- team: yoshi-admins - permission: admin -- team: yoshi-java-admins - permission: admin -- team: yoshi-java - permission: push \ No newline at end of file diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml deleted file mode 100644 index f247d5c7..00000000 --- a/.github/trusted-contribution.yml +++ /dev/null @@ -1,2 +0,0 @@ -trustedContributors: -- renovate-bot \ No newline at end of file diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml deleted file mode 100644 index 7513acae..00000000 --- a/.github/workflows/approve-readme.yaml +++ /dev/null @@ -1,54 +0,0 @@ -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@v3 - 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 7c8816a7..00000000 --- a/.github/workflows/auto-release.yaml +++ /dev/null @@ -1,88 +0,0 @@ -on: - pull_request: -name: auto-release -jobs: - approve: - runs-on: ubuntu-latest - if: contains(github.head_ref, 'release-please') - steps: - - uses: actions/github-script@v3 - 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(master): release " - if ( !context.payload.pull_request.title.startsWith("chore(master): release") ) { - return; - } - - // only approve PRs with pom.xml and versions.txt changes - const filesPromise = github.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.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.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.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 98a472e1..00000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,90 +0,0 @@ -on: - push: - branches: - - master - pull_request: -name: ci -jobs: - units: - runs-on: ubuntu-latest - strategy: - matrix: - java: [7, 8, 11] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: test - - name: coverage - uses: codecov/codecov-action@v1 - with: - name: actions ${{matrix.java}} - windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: 8 - - run: java -version - - run: .kokoro/build.bat - env: - JOB_TYPE: test - dependencies: - runs-on: ubuntu-latest - strategy: - matrix: - java: [8, 11] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/dependencies.sh - linkage-monitor: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: 8 - - run: java -version - - name: Install artifacts to local Maven repository - run: | - source .kokoro/common.sh - retry_with_backoff 3 10 \ - mvn install -B -V \ - -Dmaven.test.skip -DskipTests=true \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dmaven.javadoc.skip=true \ - -Dgcloud.download.skip=true - shell: bash - - uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: 8 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: lint - clirr: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: 8 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: clirr \ No newline at end of file diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml deleted file mode 100644 index c46230a7..00000000 --- a/.github/workflows/samples.yaml +++ /dev/null @@ -1,14 +0,0 @@ -on: - pull_request: -name: samples -jobs: - checkstyle: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - 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 05826ad9..00000000 --- a/.kokoro/build.bat +++ /dev/null @@ -1,3 +0,0 @@ -:: 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 65fc63fd..00000000 --- a/.kokoro/build.sh +++ /dev/null @@ -1,118 +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 Java version -java -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 \ - -DskipTests=true \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dmaven.javadoc.skip=true \ - -Dgcloud.download.skip=true \ - -T 1C - -# if GOOGLE_APPLICATION_CREDIENTIALS is specified as a relative path prepend Kokoro root directory onto it -if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then - export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) -fi - -RETURN_CODE=0 -set +e - -case ${JOB_TYPE} in -test) - mvn test -B -Dclirr.skip=true -Denforcer.skip=true - RETURN_CODE=$? - ;; -lint) - mvn com.coveo:fmt-maven-plugin:check - RETURN_CODE=$? - ;; -javadoc) - mvn javadoc:javadoc javadoc:test-javadoc - RETURN_CODE=$? - ;; -integration) - mvn -B ${INTEGRATION_TEST_ARGS} \ - -Penable-integration-tests \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - 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 - pushd ${SAMPLES_DIR} - mvn -B \ - -Penable-samples \ - -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 -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_BUILD_COP}" == "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 5cf7ba49..00000000 --- a/.kokoro/coerce_logs.sh +++ /dev/null @@ -1,38 +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 - echo "processing ${xml}" - class=$(basename ${xml} | cut -d- -f2) - dir=$(dirname ${xml})/${job}/${class} - text=$(dirname ${xml})/${class}-sponge_log.txt - mkdir -p ${dir} - mv ${xml} ${dir}/sponge_log.xml - mv ${text} ${dir}/sponge_log.txt -done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg 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 ace89f45..00000000 --- a/.kokoro/common.sh +++ /dev/null @@ -1,58 +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) $*"; } \ 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/continuous/readme.cfg b/.kokoro/continuous/readme.cfg deleted file mode 100644 index 369e4490..00000000 --- a/.kokoro/continuous/readme.cfg +++ /dev/null @@ -1,55 +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 -# -# 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. - -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-language/.kokoro/readme.sh" -} - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - regex: "**/*sponge_log.log" - } -} - -# The github token is stored here. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - # TODO(theacodes): remove this after secrets have globally propagated - backend_type: FASTCONFIGPUSH - } - } -} - -# Common env vars for all repositories and builds. -env_vars: { - key: "GITHUB_USER" - value: "yoshi-automation" -} -env_vars: { - key: "GITHUB_EMAIL" - value: "yoshi-automation@google.com" -} diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh deleted file mode 100755 index c91e5a56..00000000 --- a/.kokoro/dependencies.sh +++ /dev/null @@ -1,89 +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 Java -java -version -echo $JOB_TYPE - -export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" - -# this should run maven enforcer -retry_with_backoff 3 10 \ - mvn install -B -V \ - -DskipTests=true \ - -Dclirr.skip=true - -mvn -B dependency:analyze -DfailOnWarning=true - -echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" -## Run dependency list completeness check -function completenessCheck() { - # Output dep list with compile scope generated using the original pom - # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. - # This is stripped from the output as it is not present in the flattened pom. - # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. - msg "Generating dependency list using original pom..." - mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e s/\\s--\\smodule.*// >.org-list.txt - - # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) - msg "Generating dependency list using flattened pom..." - mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt - - # Compare two dependency lists - msg "Comparing dependency lists..." - diff .org-list.txt .new-list.txt >.diff.txt - if [[ $? == 0 ]] - then - msg "Success. No diff!" - else - msg "Diff found. See below: " - msg "You can also check .diff.txt file located in $1." - cat .diff.txt - return 1 - fi -} - -# Allow failures to continue running the script -set +e - -error_count=0 -for path in $(find -name ".flattened-pom.xml") -do - # Check flattened pom in each dir that contains it for completeness - dir=$(dirname "$path") - pushd "$dir" - completenessCheck "$dir" - error_count=$(($error_count + $?)) - popd -done - -if [[ $error_count == 0 ]] -then - msg "All checks passed." - exit 0 -else - msg "Errors found. See log statements above." - exit 1 -fi \ No newline at end of file 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 0048c8ec..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: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "ENABLE_BUILD_COP" - value: "true" -} - -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 f2542931..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_BUILD_COP" - value: "true" -} 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/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 6e3f6599..00000000 --- a/.kokoro/release/common.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Get secrets from keystore and set and environment variables -setup_environment_secrets() { - export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) - export GPG_TTY=$(tty) - export GPG_HOMEDIR=/gpg - mkdir $GPG_HOMEDIR - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg - export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') - export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') -} - -create_settings_xml_file() { - echo " - - - ossrh - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-staging - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-snapshots - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - -" > $1 -} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg 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 5c4551ef..00000000 --- a/.kokoro/release/drop.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:drop -B \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg 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 1fa95fa5..00000000 --- a/.kokoro/release/promote.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh - -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg deleted file mode 100644 index acd70297..00000000 --- a/.kokoro/release/publish_javadoc.cfg +++ /dev/null @@ -1,29 +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: "STAGING_BUCKET_V2" - value: "docs-staging-v2" - # Production will be at: docs-staging-v2 -} - -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" - } - } -} \ No newline at end of file diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh deleted file mode 100755 index 588cc90e..00000000 --- a/.kokoro/release/publish_javadoc.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -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 gcp-docuploader - -# 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} - -popd - -# V2 due to problems w/ the released javadoc plugin doclava, Java 8 is required. Beware of accidental updates. - -mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/" - -pushd target/devsite/reference - -# 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_V2} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg deleted file mode 100644 index aa0380b4..00000000 --- a/.kokoro/release/publish_javadoc11.cfg +++ /dev/null @@ -1,30 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "STAGING_BUCKET_V2" - value: "docs-staging-v2" - # Production will be at: 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 a68fe678..00000000 --- a/.kokoro/release/publish_javadoc11.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# Copyright 2021 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET_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 gcp-docuploader - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-language -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# V3 generates docfx yml from javadoc -# generate yml -mvn clean site -B -q -P docFX - -pushd target/docfx-yml - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --language java - -# upload yml -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 098168a7..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 install deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg 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 16126d2e..00000000 --- a/.kokoro/release/stage.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Start the releasetool reporter -python3 -m pip install gcp-releasetool -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -source $(dirname "$0")/common.sh -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 install deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DskipTests=true \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} - -if [[ -n "${AUTORELEASE_PR}" ]] -then - mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml -fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh deleted file mode 100644 index 9da0f839..00000000 --- a/.kokoro/trampoline.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -set -eo pipefail -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(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 b73cd6d4..00000000 --- a/.repo-metadata.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "language", - "name_pretty": "Natural Language", - "product_documentation": "https://cloud.google.com/natural-language/docs/", - "client_documentation": "https://googleapis.dev/java/google-cloud-language/latest/", - "issue_tracker": "https://issuetracker.google.com/savedsearches/559753", - "release_level": "ga", - "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." -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 0de8190a..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,187 +0,0 @@ -# Changelog - -### [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/CONTRIBUTING.md b/CONTRIBUTING.md index f2dbdee0..b65dd279 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,12 +53,12 @@ mvn -Penable-integration-tests clean verify ## Code Samples -Code Samples must be bundled in separate Maven modules, and guarded by a -Maven profile with the name `enable-samples`. +All code samples must be in compliance with the [java sample formatting guide][3]. +Code Samples must be bundled in separate Maven modules. The samples must be separate from the primary project for a few reasons: -1. Primary projects have a minimum Java version of Java 7 whereas samples have - a minimum Java version of Java 8. Due to this we need the ability to +1. Primary projects have a minimum Java version of Java 8 whereas samples can have + Java version of Java 11. Due to this we need the ability to selectively exclude samples from a build run. 2. Many code samples depend on external GCP services and need credentials to access the service. @@ -68,39 +68,16 @@ The samples must be separate from the primary project for a few reasons: ### Building ```bash -mvn -Penable-samples clean verify +mvn clean verify ``` Some samples require access to GCP services and require a service account: ```bash export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json -mvn -Penable-samples clean verify +mvn clean verify ``` -### Profile Config - -1. To add samples in a profile to your Maven project, add the following to your -`pom.xml` - - ```xml - - [...] - - - enable-samples - - sample - - - - [...] - - ``` - -2. [Activate](#profile-activation) the profile. -3. Define your samples in a normal Maven project in the `samples/` directory. - ### Code Formatting Code in this repo is formatted with @@ -110,30 +87,6 @@ To run formatting on your project, you can run: mvn com.coveo:fmt-maven-plugin:format ``` -### Profile Activation - -To include code samples when building and testing the project, enable the -`enable-samples` Maven profile. - -#### Command line - -To activate the Maven profile on the command line add `-Penable-samples` to your -Maven command. - -#### Maven `settings.xml` - -To activate the Maven profile in your `~/.m2/settings.xml` add an entry of -`enable-samples` following the instructions in [Active Profiles][2]. - -This method has the benefit of applying to all projects you build (and is -respected by IntelliJ IDEA) and is recommended if you are going to be -contributing samples to several projects. - -#### IntelliJ IDEA - -To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in -[Activate Maven profiles][3] to activate `enable-samples`. - [1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account [2]: https://maven.apache.org/settings.html#Active_Profiles -[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles +[3]: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md \ No newline at end of file diff --git a/README.md b/README.md index 8517e69a..9cecfa6b 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,25 @@ Java idiomatic client for [Natural Language][product-docs]. - [Product Documentation][product-docs] - [Client Library Documentation][javadocs] + +:bus: In October 2022, 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. +Future releases will appear in the new repository (https://github.com/googleapis/google-cloud-java/releases). +The Maven artifact coordinates (`com.google.cloud:google-cloud-language`) remain the same. + ## Quickstart -If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file +If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: + ```xml com.google.cloud libraries-bom - 16.4.0 + 26.11.0 pom import @@ -34,35 +43,44 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file If you are using Maven without BOM, add this to your dependencies: + ```xml com.google.cloud google-cloud-language - 1.101.9 + 2.4.1 ``` -If you are using Gradle 5.x or later, add this to your dependencies +If you are using Gradle 5.x or later, add this to your dependencies: + ```Groovy -implementation platform('com.google.cloud:libraries-bom:16.4.0') +implementation platform('com.google.cloud:libraries-bom:26.11.0') -compile 'com.google.cloud:google-cloud-language' +implementation 'com.google.cloud:google-cloud-language' ``` -If you are using Gradle without BOM, add this to your dependencies +If you are using Gradle without BOM, add this to your dependencies: + ```Groovy -compile 'com.google.cloud:google-cloud-language:1.101.10' +implementation 'com.google.cloud:google-cloud-language:2.14.0' ``` -If you are using SBT, add this to your dependencies +If you are using SBT, add this to your dependencies: + ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-language" % "1.101.10" +libraryDependencies += "com.google.cloud" % "google-cloud-language" % "2.14.0" ``` + ## Authentication See the [Authentication][authentication] section in the base directory's README. +## Authorization + +The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired Natural Language APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the Natural Language API calls. + ## Getting Started ### Prerequisites @@ -70,7 +88,7 @@ See the [Authentication][authentication] section in the base directory's README. You will need a [Google Cloud Platform Console][developer-console] project with the Natural Language [API enabled][enable-api]. You will need to [enable billing][enable-billing] to use Google Natural Language. [Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by -[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line: +[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line: `gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. ### Installation and setup @@ -124,15 +142,11 @@ In [AnalyzeSentiment.java](https://github.com/googleapis/google-cloud-java/blob/ ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/java-language/tree/master/samples) directory. The samples' `README.md` -has instructions for running the samples. +Samples are in the [`samples/`](https://github.com/googleapis/java-language/tree/main/samples) directory. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Analyze Beta | [source code](https://github.com/googleapis/java-language/blob/master/samples/snippets/src/main/java/beta/example/language/AnalyzeBeta.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-language&page=editor&open_in_editor=samples/snippets/src/main/java/beta/example/language/AnalyzeBeta.java) | -| Analyze | [source code](https://github.com/googleapis/java-language/blob/master/samples/snippets/src/main/java/com/example/language/Analyze.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-language&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/language/Analyze.java) | -| Quickstart Sample | [source code](https://github.com/googleapis/java-language/blob/master/samples/snippets/src/main/java/com/example/language/QuickstartSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-language&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/language/QuickstartSample.java) | -| Set Endpoint | [source code](https://github.com/googleapis/java-language/blob/master/samples/snippets/src/main/java/com/example/language/SetEndpoint.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-language&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/language/SetEndpoint.java) | +| Analyze Beta | [source code](https://github.com/googleapis/java-language/blob/main/samples/snippets/src/main/java/beta/example/language/AnalyzeBeta.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-language&page=editor&open_in_editor=samples/snippets/src/main/java/beta/example/language/AnalyzeBeta.java) | @@ -144,9 +158,49 @@ To get help, follow the instructions in the [shared Troubleshooting document][tr Natural Language uses gRPC for the transport layer. -## Java Versions +## Supported Java Versions + +Java 8 or above is required for using this client. + +Google's Java client libraries, +[Google Cloud Client Libraries][cloudlibs] +and +[Google Cloud API Libraries][apilibs], +follow the +[Oracle Java SE support roadmap][oracle] +(see the Oracle Java SE Product Releases section). + +### For new development -Java 7 or above is required for using this client. +In general, new feature development occurs with support for the lowest Java +LTS version covered by Oracle's Premier Support (which typically lasts 5 years +from initial General Availability). If the minimum required JVM for a given +library is changed, it is accompanied by a [semver][semver] major release. + +Java 11 and (in September 2021) Java 17 are the best choices for new +development. + +### Keeping production systems current + +Google tests its client libraries with all current LTS versions covered by +Oracle's Extended Support (which typically lasts 8 years from initial +General Availability). + +#### Legacy support + +Google's client libraries support legacy versions of Java runtimes with long +term stable libraries that don't receive feature updates on a best efforts basis +as it may not be possible to backport all patches. + +Google provides updates on a best efforts basis to apps that continue to use +Java 7, though apps might need to upgrade to current versions of the library +that supports their JVM. + +#### Where to find specific information + +The latest versions and the supported Java versions are identified on +the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` +and on [google-cloud-java][g-c-j]. ## Versioning @@ -154,6 +208,7 @@ Java 7 or above is required for using this client. This library follows [Semantic Versioning](http://semver.org/). + ## Contributing @@ -165,6 +220,7 @@ Please note that this project is released with a Contributor Code of Conduct. By this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information. + ## License Apache 2.0 - See [LICENSE][license] for more information. @@ -173,7 +229,6 @@ Apache 2.0 - See [LICENSE][license] for more information. Java Version | Status ------------ | ------ -Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1] Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] @@ -182,7 +237,7 @@ Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] Java is a registered trademark of Oracle and/or its affiliates. [product-docs]: https://cloud.google.com/natural-language/docs/ -[javadocs]: https://googleapis.dev/java/google-cloud-language/latest/ +[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-language/latest/history [kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java7.svg [kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java7.html [kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java8.svg @@ -193,18 +248,27 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java8-win.html [kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java11.svg [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java11.html -[stability-image]: https://img.shields.io/badge/stability-ga-green +[stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-language.svg -[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-language&core=gav +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-language/2.14.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication +[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes +[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles +[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy [developer-console]: https://console.developers.google.com/ [create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects -[cloud-sdk]: https://cloud.google.com/sdk/ -[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/master/troubleshooting/readme.md#troubleshooting -[contributing]: https://github.com/googleapis/java-language/blob/master/CONTRIBUTING.md -[code-of-conduct]: https://github.com/googleapis/java-language/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct -[license]: https://github.com/googleapis/java-language/blob/master/LICENSE +[cloud-cli]: https://cloud.google.com/cli +[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting +[contributing]: https://github.com/googleapis/java-language/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-language/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-language/blob/main/LICENSE [enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing [enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=language.googleapis.com [libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png + +[semver]: https://semver.org/ +[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained +[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries +[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html +[g-c-j]: http://github.com/googleapis/google-cloud-java diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..8b58ae9c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. 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 6b207bda..00000000 --- a/google-cloud-language-bom/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-language-bom - 1.101.11-SNAPSHOT - pom - - com.google.cloud - google-cloud-shared-config - 0.10.0 - - - 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 - - - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - - - com.google.api.grpc - grpc-google-cloud-language-v1 - 1.83.11-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-language-v1beta2 - 0.84.11-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-language-v1 - 1.83.11-SNAPSHOT - - - com.google.cloud - google-cloud-language - 1.101.11-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - 0.84.11-SNAPSHOT - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - - - - - \ No newline at end of file diff --git a/google-cloud-language/pom.xml b/google-cloud-language/pom.xml deleted file mode 100644 index 1c451776..00000000 --- a/google-cloud-language/pom.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-language - 1.101.11-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 - 1.101.11-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 - - - 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-grpc - testlib - test - - - - - - java9 - - [9,) - - - - javax.annotation - javax.annotation-api - - - - - - - - - org.codehaus.mojo - flatten-maven-plugin - - - - \ No newline at end of file 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 b45fe8a6..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java +++ /dev/null @@ -1,741 +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 com.google.api.core.BetaApi; -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
- * 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
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder().setEndpoint(myEndpoint).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). - */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - 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(); - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - protected LanguageServiceClient(LanguageServiceStub stub) { - this.settings = null; - this.stub = stub; - } - - public final LanguageServiceSettings getSettings() { - return settings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public LanguageServiceStub getStub() { - return stub; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeSentimentResponse response =
-   *       languageServiceClient.analyzeSentiment(document, encodingType);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitiesResponse response = languageServiceClient.analyzeEntities(document);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeEntitiesResponse response =
-   *       languageServiceClient.analyzeEntities(document, encodingType);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(document);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeEntitySentimentResponse response =
-   *       languageServiceClient.analyzeEntitySentiment(document, encodingType);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.forNumber(0);
-   *   AnalyzeSyntaxResponse response = languageServiceClient.analyzeSyntax(document, encodingType);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   ClassifyTextResponse response = languageServiceClient.classifyText(document);
-   * }
-   * }
- * - * @param document 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder().setDocument(Document.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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder().setDocument(Document.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
-   * 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 Input document. - * @param features 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
-   * 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 Input document. - * @param features 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .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 dadcd028..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java +++ /dev/null @@ -1,241 +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 com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientSettings; -import com.google.api.gax.rpc.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
- * 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 ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return LanguageServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - 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 builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected 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()); - } - - public LanguageServiceStubSettings.Builder getStubSettingsBuilder() { - return ((LanguageServiceStubSettings.Builder) getStubSettings()); - } - - // NEXT_MAJOR_VER: remove 'throws Exception'. - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to 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/package-info.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java deleted file mode 100644 index 12a3ad8b..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java +++ /dev/null @@ -1,37 +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. - */ - -/** - * 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
- * 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 7ea4001a..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java +++ /dev/null @@ -1,113 +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.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 8aef5392..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java +++ /dev/null @@ -1,285 +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.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; - } - - public UnaryCallable - analyzeSentimentCallable() { - return analyzeSentimentCallable; - } - - public UnaryCallable analyzeEntitiesCallable() { - return analyzeEntitiesCallable; - } - - public UnaryCallable - analyzeEntitySentimentCallable() { - return analyzeEntitySentimentCallable; - } - - public UnaryCallable analyzeSyntaxCallable() { - return analyzeSyntaxCallable; - } - - public UnaryCallable classifyTextCallable() { - return classifyTextCallable; - } - - public UnaryCallable annotateTextCallable() { - return annotateTextCallable; - } - - @Override - public final void close() { - shutdown(); - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-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 c6c1598e..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java +++ /dev/null @@ -1,72 +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.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 cba4767f..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java +++ /dev/null @@ -1,413 +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.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.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
- * 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; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public LanguageServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcLanguageServiceStub.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 service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(LanguageServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected 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()); - - 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; - } - - // NEXT_MAJOR_VER: remove 'throws Exception'. - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to 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 396b0598..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java +++ /dev/null @@ -1,743 +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 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
- * 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
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder().setEndpoint(myEndpoint).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). - */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - 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(); - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - protected LanguageServiceClient(LanguageServiceStub stub) { - this.settings = null; - this.stub = stub; - } - - public final LanguageServiceSettings getSettings() { - return settings; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public LanguageServiceStub getStub() { - return stub; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Analyzes the sentiment of the provided text. - * - *

Sample code: - * - *

{@code
-   * 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
-   * 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSentimentRequest request =
-   *       AnalyzeSentimentRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * 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
-   * 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitiesRequest request =
-   *       AnalyzeEntitiesRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * 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
-   * 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeEntitySentimentRequest request =
-   *       AnalyzeEntitySentimentRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .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
-   * 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
-   * 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnalyzeSyntaxRequest request =
-   *       AnalyzeSyntaxRequest.newBuilder().setDocument(Document.newBuilder().build()).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
-   * 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder().setDocument(Document.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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   ClassifyTextRequest request =
-   *       ClassifyTextRequest.newBuilder().setDocument(Document.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
-   * 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
-   * 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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .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
-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   AnnotateTextRequest request =
-   *       AnnotateTextRequest.newBuilder()
-   *           .setDocument(Document.newBuilder().build())
-   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
-   *           .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 a48512ba..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceSettings.java +++ /dev/null @@ -1,242 +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 com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientSettings; -import com.google.api.gax.rpc.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
- * 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 ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return LanguageServiceStubSettings.defaultGrpcTransportProviderBuilder(); - } - - 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 builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected 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()); - } - - public LanguageServiceStubSettings.Builder getStubSettingsBuilder() { - return ((LanguageServiceStubSettings.Builder) getStubSettings()); - } - - // NEXT_MAJOR_VER: remove 'throws Exception'. - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to 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/package-info.java b/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/package-info.java deleted file mode 100644 index a69c2b98..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/package-info.java +++ /dev/null @@ -1,37 +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. - */ - -/** - * 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
- * 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 2f828160..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceCallableFactory.java +++ /dev/null @@ -1,115 +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.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 a6fd42b1..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceStub.java +++ /dev/null @@ -1,288 +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.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; - } - - public UnaryCallable - analyzeSentimentCallable() { - return analyzeSentimentCallable; - } - - public UnaryCallable analyzeEntitiesCallable() { - return analyzeEntitiesCallable; - } - - public UnaryCallable - analyzeEntitySentimentCallable() { - return analyzeEntitySentimentCallable; - } - - public UnaryCallable analyzeSyntaxCallable() { - return analyzeSyntaxCallable; - } - - public UnaryCallable classifyTextCallable() { - return classifyTextCallable; - } - - public UnaryCallable annotateTextCallable() { - return annotateTextCallable; - } - - @Override - public final void close() { - shutdown(); - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-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 aad75fd5..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStub.java +++ /dev/null @@ -1,74 +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.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 946651e8..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStubSettings.java +++ /dev/null @@ -1,414 +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.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.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
- * 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; - } - - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") - public LanguageServiceStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcLanguageServiceStub.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 service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); - } - - /** Returns a builder for the default ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(LanguageServiceStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected 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()); - - 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; - } - - // NEXT_MAJOR_VER: remove 'throws Exception'. - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) throws Exception { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to 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/it/ITSystemTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/it/ITSystemTest.java deleted file mode 100644 index 7505175b..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/it/ITSystemTest.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.cloud.language.it; - -import static com.google.cloud.language.v1.Document.Type; -import static com.google.cloud.language.v1.PartOfSpeech.Tag; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -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.AnalyzeSentimentResponse; -import com.google.cloud.language.v1.AnalyzeSyntaxRequest; -import com.google.cloud.language.v1.ClassificationCategory; -import com.google.cloud.language.v1.ClassifyTextRequest; -import com.google.cloud.language.v1.ClassifyTextResponse; -import com.google.cloud.language.v1.Document; -import com.google.cloud.language.v1.EncodingType; -import com.google.cloud.language.v1.Entity; -import com.google.cloud.language.v1.EntityMention; -import com.google.cloud.language.v1.LanguageServiceClient; -import com.google.cloud.language.v1.Sentiment; -import com.google.cloud.language.v1.Token; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class ITSystemTest { - - private static LanguageServiceClient client; - private static final String GCS_BUCKET; - private static final String GCS_BUCKET_ENV_VAR = "GOOGLE_CLOUD_TESTS_LANGUAGE_BUCKET"; - - static { - if (System.getenv(GCS_BUCKET_ENV_VAR) != null) { - GCS_BUCKET = System.getenv(GCS_BUCKET_ENV_VAR); - } else { - GCS_BUCKET = "cloud-samples-data"; - } - } - - private static final String ANALYZE_TEXT = - "Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets."; - - @Before - public void setUp() throws IOException { - client = LanguageServiceClient.create(); - } - - @After - public void tearDown() { - client.close(); - } - - @Test - public void analyzeEntitiesFileTest() { - Document doc = - Document.newBuilder() - .setGcsContentUri(String.format("gs://%s/language/android.txt", GCS_BUCKET)) - .setType(Type.PLAIN_TEXT) - .build(); - AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder().setDocument(doc).build(); - AnalyzeEntitiesResponse response = client.analyzeEntities(request); - for (Entity entity : response.getEntitiesList()) { - if (entity.getName().equals("Android")) { - assertEquals(Entity.Type.CONSUMER_GOOD, entity.getType()); - assertEquals(0.69612604, entity.getSalience(), 10); - assertEquals(2, entity.getMentionsCount()); - assertEquals(2, entity.getMetadataMap().size()); - break; - } - } - } - - @Test - public void analyzeEntitiesTextTest() { - Document doc = Document.newBuilder().setContent(ANALYZE_TEXT).setType(Type.PLAIN_TEXT).build(); - AnalyzeEntitiesRequest request = - AnalyzeEntitiesRequest.newBuilder() - .setDocument(doc) - .setEncodingType(EncodingType.UTF16) - .build(); - AnalyzeEntitiesResponse response = client.analyzeEntities(request); - for (Entity entity : response.getEntitiesList()) { - if (entity.getName().equals("Android")) { - assertEquals(Entity.Type.CONSUMER_GOOD, entity.getType()); - assertEquals(0.69612604, entity.getSalience(), 10); - assertEquals(2, entity.getMentionsCount()); - assertEquals(2, entity.getMetadataMap().size()); - break; - } - } - } - - @Test - public void analyzeEntitySentimentFileTest() { - Document doc = - Document.newBuilder() - .setGcsContentUri(String.format("gs://%s/language/president.txt", GCS_BUCKET)) - .setType(Type.PLAIN_TEXT) - .build(); - AnalyzeEntitySentimentRequest request = - AnalyzeEntitySentimentRequest.newBuilder() - .setDocument(doc) - .setEncodingType(EncodingType.UTF16) - .build(); - AnalyzeEntitySentimentResponse response = client.analyzeEntitySentiment(request); - List actual = new ArrayList<>(); - for (Entity entity : response.getEntitiesList()) { - actual.add(entity.getName()); - } - assertEquals(Arrays.asList("Kennedy", "White House"), actual); - } - - @Test - public void analyzeEntitySentimentTextWithExpectedResultTest() { - Document doc = - Document.newBuilder() - .setContent( - "Oranges, grapes, and apples can be found in the cafeterias located in Mountain View, Seattle, and London.") - .setType(Type.PLAIN_TEXT) - .build(); - AnalyzeEntitySentimentRequest request = - AnalyzeEntitySentimentRequest.newBuilder() - .setDocument(doc) - .setEncodingType(EncodingType.UTF16) - .build(); - AnalyzeEntitySentimentResponse response = client.analyzeEntitySentiment(request); - List actual = new ArrayList<>(); - for (Entity entity : response.getEntitiesList()) { - actual.add(entity.getName()); - } - assertTrue(actual.contains("Seattle")); - } - - @Test - public void analyzeEntitySentimentTextWithEncodedExpectedResultTest() { - Document doc = Document.newBuilder().setContent("foo→bar").setType(Type.PLAIN_TEXT).build(); - AnalyzeEntitySentimentRequest request = - AnalyzeEntitySentimentRequest.newBuilder() - .setDocument(doc) - .setEncodingType(EncodingType.UTF16) - .build(); - AnalyzeEntitySentimentResponse response = client.analyzeEntitySentiment(request); - List actual = new ArrayList<>(); - for (Entity entity : response.getEntitiesList()) { - for (EntityMention mention : entity.getMentionsList()) { - actual.add(mention.getText().getBeginOffset()); - } - } - assertTrue(actual.contains(4)); - } - - @Test - public void analyzeSentimentFileWithReturnPositiveTest() { - Document doc = - Document.newBuilder() - .setGcsContentUri(String.format("gs://%s/language/sentiment-positive.txt", GCS_BUCKET)) - .setType(Type.PLAIN_TEXT) - .build(); - AnalyzeSentimentResponse response = client.analyzeSentiment(doc); - Sentiment actual = response.getDocumentSentiment(); - assertTrue(actual.getMagnitude() > 0.0F); - assertTrue(actual.getScore() > 0.0F); - } - - @Test - public void analyzeSentimentTextWithReturnPositiveTest() { - Document doc = - Document.newBuilder() - .setContent("Tom Cruise is one of the finest actors in hollywood and a great star!") - .setType(Type.PLAIN_TEXT) - .build(); - Sentiment sentiment = client.analyzeSentiment(doc).getDocumentSentiment(); - assertTrue(sentiment.getMagnitude() > 0.0F); - assertTrue(sentiment.getScore() > 0.0F); - } - - @Test - public void analyzeSentimentFileWithReturnNegativeTest() { - Document doc = - Document.newBuilder() - .setGcsContentUri(String.format("gs://%s/language/sentiment-negative.txt", GCS_BUCKET)) - .setType(Type.PLAIN_TEXT) - .build(); - Sentiment sentiment = client.analyzeSentiment(doc).getDocumentSentiment(); - assertTrue(sentiment.getMagnitude() > 0.0F); - assertTrue(sentiment.getScore() < 0.0F); - } - - @Test - public void analyzeSentimentTextWithReturnNegativeTest() { - Document doc = - Document.newBuilder() - .setContent("That was the worst performance I've seen in a while.") - .setType(Type.PLAIN_TEXT) - .build(); - Sentiment sentiment = client.analyzeSentiment(doc).getDocumentSentiment(); - assertTrue(sentiment.getMagnitude() > 0.0F); - assertTrue(sentiment.getScore() < 0.0F); - } - - @Test - public void analyzeSyntaxFileTest() { - Document doc = - Document.newBuilder() - .setGcsContentUri(String.format("gs://%s/language/syntax-sentence.txt", GCS_BUCKET)) - .setType(Type.PLAIN_TEXT) - .build(); - AnalyzeSyntaxRequest request = - AnalyzeSyntaxRequest.newBuilder() - .setDocument(doc) - .setEncodingType(EncodingType.UTF16) - .build(); - List tokens = client.analyzeSyntax(request).getTokensList(); - List expected = Arrays.asList(Tag.DET, Tag.VERB, Tag.DET, Tag.ADJ, Tag.NOUN, Tag.PUNCT); - List actual = new ArrayList<>(); - for (Token token : tokens) { - actual.add(token.getPartOfSpeech().getTag()); - } - assertEquals(expected, actual); - } - - @Test - public void analyzeSyntaxTextTest() { - Document doc = - Document.newBuilder() - .setContent("President Obama was elected for the second term") - .setType(Type.PLAIN_TEXT) - .build(); - AnalyzeSyntaxRequest request = - AnalyzeSyntaxRequest.newBuilder() - .setDocument(doc) - .setEncodingType(EncodingType.UTF16) - .build(); - List tokens = client.analyzeSyntax(request).getTokensList(); - List expected = - Arrays.asList(Tag.NOUN, Tag.NOUN, Tag.VERB, Tag.VERB, Tag.ADP, Tag.DET, Tag.ADJ, Tag.NOUN); - List actual = new ArrayList<>(); - for (Token token : tokens) { - actual.add(token.getPartOfSpeech().getTag()); - } - assertEquals(expected, actual); - } - - @Test - public void classifyFileTest() { - Document doc = - Document.newBuilder() - .setGcsContentUri(String.format("gs://%s/language/android.txt", GCS_BUCKET)) - .setType(Type.PLAIN_TEXT) - .build(); - ClassifyTextRequest request = ClassifyTextRequest.newBuilder().setDocument(doc).build(); - ClassifyTextResponse response = client.classifyText(request); - List expected = - Arrays.asList( - "/Computers & Electronics", - "/Internet & Telecom/Mobile & Wireless/Mobile Apps & Add-Ons"); - List actual = new ArrayList<>(); - for (ClassificationCategory category : response.getCategoriesList()) { - actual.add(category.getName()); - } - assertEquals(expected, actual); - } - - @Test - public void classifyTextTest() { - Document doc = Document.newBuilder().setContent(ANALYZE_TEXT).setType(Type.PLAIN_TEXT).build(); - ClassifyTextRequest request = ClassifyTextRequest.newBuilder().setDocument(doc).build(); - ClassifyTextResponse response = client.classifyText(request); - List expected = - Arrays.asList( - "/Computers & Electronics", - "/Internet & Telecom/Mobile & Wireless/Mobile Apps & Add-Ons"); - List actual = new ArrayList<>(); - for (ClassificationCategory category : response.getCategoriesList()) { - actual.add(category.getName()); - } - assertEquals(expected, actual); - } -} 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 f9e16590..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java +++ /dev/null @@ -1,542 +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 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 MockServiceHelper mockServiceHelper; - private LanguageServiceClient client; - private static MockLanguageService mockLanguageService; - private LocalChannelProvider channelProvider; - - @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/LanguageServiceSmokeTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceSmokeTest.java deleted file mode 100644 index 208f60cf..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceSmokeTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.cloud.language.v1; - -import com.google.common.base.Preconditions; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class LanguageServiceSmokeTest { - private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT"; - private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT"; - - @Test - public void run() { - main(null); - } - - public static void main(String args[]) { - Logger.getLogger("").setLevel(Level.WARNING); - try { - executeNoCatch(); - System.out.println("OK"); - } catch (Exception e) { - System.err.println("Failed with exception:"); - e.printStackTrace(System.err); - System.exit(1); - } - } - - public static void executeNoCatch() throws Exception { - try (LanguageServiceClient client = LanguageServiceClient.create()) { - String content = "Hello, world!"; - Document.Type type = Document.Type.PLAIN_TEXT; - Document document = Document.newBuilder().setContent(content).setType(type).build(); - - AnalyzeSentimentResponse response = client.analyzeSentiment(document); - } - } - - private static String getProjectId() { - String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME)); - if (projectId == null) { - projectId = - System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME)); - } - Preconditions.checkArgument(projectId != null, "A project ID is required."); - return projectId; - } -} 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 91aeee04..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java +++ /dev/null @@ -1,59 +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 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 4955e854..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java +++ /dev/null @@ -1,151 +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 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.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void analyzeEntities( - AnalyzeEntitiesRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void analyzeEntitySentiment( - AnalyzeEntitySentimentRequest request, - StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void analyzeSyntax( - AnalyzeSyntaxRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void classifyText( - ClassifyTextRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void annotateText( - AnnotateTextRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } -} 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 4fa14eed..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientTest.java +++ /dev/null @@ -1,542 +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 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 MockServiceHelper mockServiceHelper; - private LanguageServiceClient client; - private static MockLanguageService mockLanguageService; - private LocalChannelProvider channelProvider; - - @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 e23658e1..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageService.java +++ /dev/null @@ -1,59 +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 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 aaa97551..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageServiceImpl.java +++ /dev/null @@ -1,151 +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 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.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void analyzeEntities( - AnalyzeEntitiesRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void analyzeEntitySentiment( - AnalyzeEntitySentimentRequest request, - StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void analyzeSyntax( - AnalyzeSyntaxRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void classifyText( - ClassifyTextRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } - - @Override - public void annotateText( - AnnotateTextRequest request, StreamObserver responseObserver) { - Object response = responses.remove(); - 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("Unrecognized response type")); - } - } -} diff --git a/grpc-google-cloud-language-v1/pom.xml b/grpc-google-cloud-language-v1/pom.xml deleted file mode 100644 index edb063e6..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 - 1.83.11-SNAPSHOT - grpc-google-cloud-language-v1 - GRPC library for grpc-google-cloud-language-v1 - - com.google.cloud - google-cloud-language-parent - 1.101.11-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 9232e941..00000000 --- a/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java +++ /dev/null @@ -1,995 +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; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - * - * - *
- * 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") -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) { - 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) { - 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) { - 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) { - asyncUnimplementedUnaryCall(getAnalyzeSyntaxMethod(), responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - 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) { - asyncUnimplementedUnaryCall(getAnnotateTextMethod(), responseObserver); - } - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getAnalyzeSentimentMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse>( - this, METHODID_ANALYZE_SENTIMENT))) - .addMethod( - getAnalyzeEntitiesMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse>( - this, METHODID_ANALYZE_ENTITIES))) - .addMethod( - getAnalyzeEntitySentimentMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>( - this, METHODID_ANALYZE_ENTITY_SENTIMENT))) - .addMethod( - getAnalyzeSyntaxMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse>( - this, METHODID_ANALYZE_SYNTAX))) - .addMethod( - getClassifyTextMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse>( - this, METHODID_CLASSIFY_TEXT))) - .addMethod( - getAnnotateTextMethod(), - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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 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 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 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 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 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 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 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 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 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 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 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 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 0add5914..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.84.11-SNAPSHOT - grpc-google-cloud-language-v1beta2 - GRPC library for grpc-google-cloud-language-v1beta2 - - com.google.cloud - google-cloud-language-parent - 1.101.11-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 bfc7b8cd..00000000 --- a/grpc-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceGrpc.java +++ /dev/null @@ -1,1000 +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; -import static io.grpc.stub.ClientCalls.asyncUnaryCall; -import static io.grpc.stub.ClientCalls.blockingUnaryCall; -import static io.grpc.stub.ClientCalls.futureUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnaryCall; -import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; - -/** - * - * - *
- * 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") -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) { - 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) { - 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) { - 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) { - asyncUnimplementedUnaryCall(getAnalyzeSyntaxMethod(), responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1beta2.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - 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) { - asyncUnimplementedUnaryCall(getAnnotateTextMethod(), responseObserver); - } - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getAnalyzeSentimentMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse>( - this, METHODID_ANALYZE_SENTIMENT))) - .addMethod( - getAnalyzeEntitiesMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse>( - this, METHODID_ANALYZE_ENTITIES))) - .addMethod( - getAnalyzeEntitySentimentMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse>( - this, METHODID_ANALYZE_ENTITY_SENTIMENT))) - .addMethod( - getAnalyzeSyntaxMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse>( - this, METHODID_ANALYZE_SYNTAX))) - .addMethod( - getClassifyTextMethod(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse>( - this, METHODID_CLASSIFY_TEXT))) - .addMethod( - getAnnotateTextMethod(), - 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) { - 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) { - 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) { - 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) { - 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) { - 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) { - 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 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 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 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 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 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 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 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 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 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 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 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 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 3a9b503a..00000000 --- a/java.header +++ /dev/null @@ -1,15 +0,0 @@ -^/\*$ -^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)( All [rR]ights [rR]eserved\.)?$ -^ \*$ -^ \* 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 5c5783a4..00000000 --- a/pom.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-language-parent - pom - 1.101.11-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 - 0.10.0 - - - - - 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 - - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - sonatype-nexus-staging - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - Apache-2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - - - - - UTF-8 - UTF-8 - github - google-cloud-language-parent - - - - - - com.google.api.grpc - proto-google-cloud-language-v1 - 1.83.11-SNAPSHOT - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - 0.84.11-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-language-v1 - 1.83.11-SNAPSHOT - - - com.google.api.grpc - grpc-google-cloud-language-v1beta2 - 0.84.11-SNAPSHOT - - - com.google.cloud - google-cloud-language - 1.101.11-SNAPSHOT - - - - com.google.cloud - google-cloud-shared-dependencies - 0.18.0 - pom - import - - - - junit - junit - 4.13.2 - test - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - org.objenesis:objenesis - javax.annotation:javax.annotation-api - - - - - - - - - proto-google-cloud-language-v1 - proto-google-cloud-language-v1beta2 - grpc-google-cloud-language-v1 - grpc-google-cloud-language-v1beta2 - google-cloud-language - google-cloud-language-bom - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.1.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.2.0 - - - 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/pom.xml b/proto-google-cloud-language-v1/pom.xml deleted file mode 100644 index 9e0d99d5..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 - 1.83.11-SNAPSHOT - proto-google-cloud-language-v1 - PROTO library for proto-google-cloud-language-v1 - - com.google.cloud - google-cloud-language-parent - 1.101.11-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 53bdded0..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java +++ /dev/null @@ -1,908 +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; - } - - private AnalyzeEntitiesRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Document.Builder subBuilder = null; - if (document_ != null) { - subBuilder = document_.toBuilder(); - } - document_ = - input.readMessage( - com.google.cloud.language.v1.Document.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(document_); - document_ = subBuilder.buildPartial(); - } - - break; - } - case 16: - { - int rawValue = input.readEnum(); - - encodingType_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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_; - /** - * - * - *
-   * 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; - } - /** - * - * - *
-   * 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_; - } - /** - * - * - *
-   * 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_); - } - unknownFields.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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeEntitiesRequest parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeEntitiesRequest) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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_; - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - /** - * - * - *
-     * 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_; - } - } - /** - * - * - *
-     * 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 { - return new AnalyzeEntitiesRequest(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 1e4f6bc4..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 { - - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * 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 d41fead7..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java +++ /dev/null @@ -1,1141 +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; - } - - private AnalyzeEntitiesResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - entities_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - entities_.add( - input.readMessage( - com.google.cloud.language.v1.Entity.parser(), extensionRegistry)); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - language_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - entities_ = java.util.Collections.unmodifiableList(entities_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - 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 (!getLanguageBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_); - } - unknownFields.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 (!getLanguageBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getEntitiesFieldBuilder(); - } - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - entitiesBuilder_.clear(); - } - 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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeEntitiesResponse parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeEntitiesResponse) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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 { - return new AnalyzeEntitiesResponse(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 09be9c7a..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java +++ /dev/null @@ -1,909 +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; - } - - private AnalyzeEntitySentimentRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Document.Builder subBuilder = null; - if (document_ != null) { - subBuilder = document_.toBuilder(); - } - document_ = - input.readMessage( - com.google.cloud.language.v1.Document.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(document_); - document_ = subBuilder.buildPartial(); - } - - break; - } - case 16: - { - int rawValue = input.readEnum(); - - encodingType_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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_; - /** - * - * - *
-   * 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; - } - /** - * - * - *
-   * 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_; - } - /** - * - * - *
-   * 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_); - } - unknownFields.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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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_; - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - /** - * - * - *
-     * 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_; - } - } - /** - * - * - *
-     * 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 { - return new AnalyzeEntitySentimentRequest(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 f53159b9..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 { - - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * 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 abaaa4a4..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java +++ /dev/null @@ -1,1143 +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; - } - - private AnalyzeEntitySentimentResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - entities_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - entities_.add( - input.readMessage( - com.google.cloud.language.v1.Entity.parser(), extensionRegistry)); - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - language_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - entities_ = java.util.Collections.unmodifiableList(entities_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - 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 (!getLanguageBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_); - } - unknownFields.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 (!getLanguageBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getEntitiesFieldBuilder(); - } - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - entitiesBuilder_.clear(); - } - 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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeEntitySentimentResponse) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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 { - return new AnalyzeEntitySentimentResponse(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 1a9a9ec8..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java +++ /dev/null @@ -1,908 +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; - } - - private AnalyzeSentimentRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Document.Builder subBuilder = null; - if (document_ != null) { - subBuilder = document_.toBuilder(); - } - document_ = - input.readMessage( - com.google.cloud.language.v1.Document.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(document_); - document_ = subBuilder.buildPartial(); - } - - break; - } - case 16: - { - int rawValue = input.readEnum(); - - encodingType_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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_; - /** - * - * - *
-   * 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; - } - /** - * - * - *
-   * 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_; - } - /** - * - * - *
-   * 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_); - } - unknownFields.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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeSentimentRequest parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeSentimentRequest) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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_; - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - /** - * - * - *
-     * 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_; - } - } - /** - * - * - *
-     * 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 { - return new AnalyzeSentimentRequest(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 eb46a9fe..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 { - - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * 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 0ab61ac7..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java +++ /dev/null @@ -1,1420 +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; - } - - private AnalyzeSentimentResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Sentiment.Builder subBuilder = null; - if (documentSentiment_ != null) { - subBuilder = documentSentiment_.toBuilder(); - } - documentSentiment_ = - input.readMessage( - com.google.cloud.language.v1.Sentiment.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(documentSentiment_); - documentSentiment_ = subBuilder.buildPartial(); - } - - break; - } - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - - language_ = s; - break; - } - case 26: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - sentences_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - sentences_.add( - input.readMessage( - com.google.cloud.language.v1.Sentence.parser(), extensionRegistry)); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - sentences_ = java.util.Collections.unmodifiableList(sentences_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - 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 (!getLanguageBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_); - } - for (int i = 0; i < sentences_.size(); i++) { - output.writeMessage(3, sentences_.get(i)); - } - unknownFields.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 (!getLanguageBytes().isEmpty()) { - 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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getSentencesFieldBuilder(); - } - } - - @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(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - sentencesBuilder_.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_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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeSentimentResponse parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeSentimentResponse) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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 { - return new AnalyzeSentimentResponse(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 61efe67e..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java +++ /dev/null @@ -1,908 +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; - } - - private AnalyzeSyntaxRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Document.Builder subBuilder = null; - if (document_ != null) { - subBuilder = document_.toBuilder(); - } - document_ = - input.readMessage( - com.google.cloud.language.v1.Document.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(document_); - document_ = subBuilder.buildPartial(); - } - - break; - } - case 16: - { - int rawValue = input.readEnum(); - - encodingType_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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_; - /** - * - * - *
-   * 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; - } - /** - * - * - *
-   * 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_; - } - /** - * - * - *
-   * 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_); - } - unknownFields.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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeSyntaxRequest parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeSyntaxRequest) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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_; - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - /** - * - * - *
-     * 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_; - } - } - /** - * - * - *
-     * 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 { - return new AnalyzeSyntaxRequest(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 410ea9f2..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 { - - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * 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 98161541..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java +++ /dev/null @@ -1,1627 +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; - } - - private AnalyzeSyntaxResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - sentences_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - sentences_.add( - input.readMessage( - com.google.cloud.language.v1.Sentence.parser(), extensionRegistry)); - break; - } - case 18: - { - if (!((mutable_bitField0_ & 0x00000002) != 0)) { - tokens_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - tokens_.add( - input.readMessage( - com.google.cloud.language.v1.Token.parser(), extensionRegistry)); - break; - } - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - - language_ = s; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - sentences_ = java.util.Collections.unmodifiableList(sentences_); - } - if (((mutable_bitField0_ & 0x00000002) != 0)) { - tokens_ = java.util.Collections.unmodifiableList(tokens_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - 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 (!getLanguageBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, language_); - } - unknownFields.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 (!getLanguageBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, language_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getSentencesFieldBuilder(); - getTokensFieldBuilder(); - } - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - sentencesBuilder_.clear(); - } - if (tokensBuilder_ == null) { - tokens_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - tokensBuilder_.clear(); - } - 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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnalyzeSyntaxResponse parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnalyzeSyntaxResponse) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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 { - return new AnalyzeSyntaxResponse(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 7e81e74b..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java +++ /dev/null @@ -1,2178 +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; - } - - private AnnotateTextRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Document.Builder subBuilder = null; - if (document_ != null) { - subBuilder = document_.toBuilder(); - } - document_ = - input.readMessage( - com.google.cloud.language.v1.Document.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(document_); - document_ = subBuilder.buildPartial(); - } - - break; - } - case 18: - { - com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder subBuilder = null; - if (features_ != null) { - subBuilder = features_.toBuilder(); - } - features_ = - input.readMessage( - com.google.cloud.language.v1.AnnotateTextRequest.Features.parser(), - extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(features_); - features_ = subBuilder.buildPartial(); - } - - break; - } - case 24: - { - int rawValue = input.readEnum(); - - encodingType_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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(); - } - /** - * - * - *
-   * 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; - } - - private Features( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - extractSyntax_ = input.readBool(); - break; - } - case 16: - { - extractEntities_ = input.readBool(); - break; - } - case 24: - { - extractDocumentSentiment_ = input.readBool(); - break; - } - case 32: - { - extractEntitySentiment_ = input.readBool(); - break; - } - case 48: - { - classifyText_ = input.readBool(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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_; - } - - 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_); - } - unknownFields.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_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + 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()); - hash = (29 * hash) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - extractSyntax_ = false; - - extractEntities_ = false; - - extractDocumentSentiment_ = false; - - extractEntitySentiment_ = false; - - classifyText_ = false; - - 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_; - 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()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnnotateTextRequest.Features parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnnotateTextRequest.Features) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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; - } - - @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 { - return new Features(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.language.v1.AnnotateTextRequest.Features getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - } - - public static final int DOCUMENT_FIELD_NUMBER = 1; - private com.google.cloud.language.v1.Document document_; - /** - * - * - *
-   * 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; - } - /** - * - * - *
-   * 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_; - } - /** - * - * - *
-   * 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_; - /** - * - * - *
-   * 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; - } - /** - * - * - *
-   * 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_; - } - /** - * - * - *
-   * 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_); - } - unknownFields.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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnnotateTextRequest parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.cloud.language.v1.AnnotateTextRequest) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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_; - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - /** - * - * - *
-     * 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_; - } - } - /** - * - * - *
-     * 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_; - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - /** - * - * - *
-     * 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_; - } - } - /** - * - * - *
-     * 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 { - return new AnnotateTextRequest(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 d998316e..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 { - - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); - - /** - * - * - *
-   * 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(); - /** - * - * - *
-   * 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(); - /** - * - * - *
-   * 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 566c760d..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java +++ /dev/null @@ -1,3017 +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; - } - - private AnnotateTextResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - sentences_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - sentences_.add( - input.readMessage( - com.google.cloud.language.v1.Sentence.parser(), extensionRegistry)); - break; - } - case 18: - { - if (!((mutable_bitField0_ & 0x00000002) != 0)) { - tokens_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - tokens_.add( - input.readMessage( - com.google.cloud.language.v1.Token.parser(), extensionRegistry)); - break; - } - case 26: - { - if (!((mutable_bitField0_ & 0x00000004) != 0)) { - entities_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - entities_.add( - input.readMessage( - com.google.cloud.language.v1.Entity.parser(), extensionRegistry)); - break; - } - case 34: - { - com.google.cloud.language.v1.Sentiment.Builder subBuilder = null; - if (documentSentiment_ != null) { - subBuilder = documentSentiment_.toBuilder(); - } - documentSentiment_ = - input.readMessage( - com.google.cloud.language.v1.Sentiment.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(documentSentiment_); - documentSentiment_ = subBuilder.buildPartial(); - } - - break; - } - case 42: - { - java.lang.String s = input.readStringRequireUtf8(); - - language_ = s; - break; - } - case 50: - { - if (!((mutable_bitField0_ & 0x00000008) != 0)) { - categories_ = - new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; - } - categories_.add( - input.readMessage( - com.google.cloud.language.v1.ClassificationCategory.parser(), - extensionRegistry)); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - sentences_ = java.util.Collections.unmodifiableList(sentences_); - } - if (((mutable_bitField0_ & 0x00000002) != 0)) { - tokens_ = java.util.Collections.unmodifiableList(tokens_); - } - if (((mutable_bitField0_ & 0x00000004) != 0)) { - entities_ = java.util.Collections.unmodifiableList(entities_); - } - if (((mutable_bitField0_ & 0x00000008) != 0)) { - categories_ = java.util.Collections.unmodifiableList(categories_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - 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 (!getLanguageBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, language_); - } - for (int i = 0; i < categories_.size(); i++) { - output.writeMessage(6, categories_.get(i)); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < 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 (!getLanguageBytes().isEmpty()) { - 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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (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) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getSentencesFieldBuilder(); - getTokensFieldBuilder(); - getEntitiesFieldBuilder(); - getCategoriesFieldBuilder(); - } - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (sentencesBuilder_ == null) { - sentences_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - sentencesBuilder_.clear(); - } - if (tokensBuilder_ == null) { - tokens_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - tokensBuilder_.clear(); - } - if (entitiesBuilder_ == null) { - entities_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - entitiesBuilder_.clear(); - } - if (documentSentimentBuilder_ == null) { - documentSentiment_ = null; - } else { - documentSentiment_ = null; - documentSentimentBuilder_ = null; - } - language_ = ""; - - if (categoriesBuilder_ == null) { - categories_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - categoriesBuilder_.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_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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.AnnotateTextResponse parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.AnnotateTextResponse) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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 { - return new AnnotateTextResponse(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 b38e9196..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java +++ /dev/null @@ -1,738 +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; - } - - private ClassificationCategory( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 21: - { - confidence_ = input.readFloat(); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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 (!getNameBytes().isEmpty()) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (confidence_ != 0F) { - output.writeFloat(2, confidence_); - } - unknownFields.writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!getNameBytes().isEmpty()) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (confidence_ != 0F) { - size += com.google.protobuf.CodedOutputStream.computeFloatSize(2, confidence_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; - hash = (53 * hash) + java.lang.Float.floatToIntBits(getConfidence()); - hash = (29 * hash) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - 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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.ClassificationCategory parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.ClassificationCategory) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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 { - return new ClassificationCategory(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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/ClassifyTextRequest.java b/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java deleted file mode 100644 index 6c1b4793..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java +++ /dev/null @@ -1,756 +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; - } - - private ClassifyTextRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.language.v1.Document.Builder subBuilder = null; - if (document_ != null) { - subBuilder = document_.toBuilder(); - } - document_ = - input.readMessage( - com.google.cloud.language.v1.Document.parser(), extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(document_); - document_ = subBuilder.buildPartial(); - } - - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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_; - /** - * - * - *
-   * 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; - } - /** - * - * - *
-   * 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_; - } - /** - * - * - *
-   * 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(); - } - - 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()); - } - unknownFields.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()); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDocument()) { - hash = (37 * hash) + DOCUMENT_FIELD_NUMBER; - hash = (53 * hash) + getDocument().hashCode(); - } - hash = (29 * hash) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (documentBuilder_ == null) { - document_ = null; - } else { - document_ = null; - documentBuilder_ = 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(); - } - 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()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.ClassifyTextRequest parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.google.cloud.language.v1.ClassifyTextRequest) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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_; - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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; - } - /** - * - * - *
-     * 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(); - } - /** - * - * - *
-     * 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_; - } - } - /** - * - * - *
-     * 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_; - } - - @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 { - return new ClassifyTextRequest(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 6d362243..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.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 ClassifyTextRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassifyTextRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the document field is set. - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The document. - */ - com.google.cloud.language.v1.Document getDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); -} 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 8ca4469a..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java +++ /dev/null @@ -1,961 +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; - } - - private ClassifyTextResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - if (!((mutable_bitField0_ & 0x00000001) != 0)) { - categories_ = - new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - categories_.add( - input.readMessage( - com.google.cloud.language.v1.ClassificationCategory.parser(), - extensionRegistry)); - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) != 0)) { - categories_ = java.util.Collections.unmodifiableList(categories_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - 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)); - } - unknownFields.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 += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.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 (!unknownFields.equals(other.unknownFields)) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getCategoriesCount() > 0) { - hash = (37 * hash) + CATEGORIES_FIELD_NUMBER; - hash = (53 * hash) + getCategoriesList().hashCode(); - } - hash = (29 * hash) + unknownFields.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() { - maybeForceBuilderInitialization(); - } - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { - getCategoriesFieldBuilder(); - } - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (categoriesBuilder_ == null) { - categories_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - } else { - categoriesBuilder_.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_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.unknownFields); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.cloud.language.v1.ClassifyTextResponse parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = - (com.google.cloud.language.v1.ClassifyTextResponse) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - 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 { - return new ClassifyTextResponse(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.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 2231df27..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java +++ /dev/null @@ -1,2634 +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; - } - - private DependencyEdge( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - headTokenIndex_ = input.readInt32(); - break; - } - case 16: - { - int rawValue = input.readEnum(); - - label_ = rawValue; - break; - } - default: - { - if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.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