diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 00000000..7bf58076 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,8 @@ +bumpMinorPreMajor: true +handleGHRelease: true +releaseType: java-yoshi +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/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..2add2547 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..b65dd279 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,92 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Building the project + +To build, package, and run all unit tests run the command + +``` +mvn clean verify +``` + +### Running Integration tests + +To include integration tests when building the project, you need access to +a GCP Project with a valid service account. + +For instructions on how to generate a service account and corresponding +credentials JSON see: [Creating a Service Account][1]. + +Then run the following to build, package, run all unit tests and run all +integration tests. + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-integration-tests clean verify +``` + +## Code 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 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. +3. Code samples are not released as Maven artifacts and must be excluded from + release builds. + +### Building + +```bash +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 clean verify +``` + +### Code Formatting + +Code in this repo is formatted with +[google-java-format](https://github.com/google/google-java-format). +To run formatting on your project, you can run: +``` +mvn com.coveo:fmt-maven-plugin:format +``` + +[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account +[2]: https://maven.apache.org/settings.html#Active_Profiles +[3]: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md \ No newline at end of file diff --git a/LICENSE b/LICENSE index 4eedc011..261eeb9e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -178,7 +178,7 @@ Apache License APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" + boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a diff --git a/README.md b/README.md new file mode 100644 index 00000000..9cecfa6b --- /dev/null +++ b/README.md @@ -0,0 +1,274 @@ +# Google Natural Language Client for Java + +Java idiomatic client for [Natural Language][product-docs]. + +[![Maven][maven-version-image]][maven-version-link] +![Stability][stability-image] + +- [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: + +```xml + + + + com.google.cloud + libraries-bom + 26.11.0 + pom + import + + + + + + + com.google.cloud + google-cloud-language + + +``` + +If you are using Maven without BOM, add this to your dependencies: + + +```xml + + com.google.cloud + google-cloud-language + 2.4.1 + + +``` + +If you are using Gradle 5.x or later, add this to your dependencies: + +```Groovy +implementation platform('com.google.cloud:libraries-bom:26.11.0') + +implementation 'com.google.cloud:google-cloud-language' +``` +If you are using Gradle without BOM, add this to your dependencies: + +```Groovy +implementation 'com.google.cloud:google-cloud-language:2.14.0' +``` + +If you are using SBT, add this to your dependencies: + +```Scala +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 + +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 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 + +You'll need to obtain the `google-cloud-language` library. See the [Quickstart](#quickstart) section +to add `google-cloud-language` as a dependency in your code. + +## About Natural Language + + +[Natural Language][product-docs] 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. + +See the [Natural Language client library docs][javadocs] to learn how to +use this Natural Language Client Library. + + +#### 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. + + + +## 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/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) | + + + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## Transport + +Natural Language uses gRPC for the transport layer. + +## 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 + +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 + + +This library follows [Semantic Versioning](http://semver.org/). + + + +## Contributing + + +Contributions to this library are always welcome and highly encouraged. + +See [CONTRIBUTING][contributing] for more information how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in +this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more +information. + + +## License + +Apache 2.0 - See [LICENSE][license] for more information. + +## CI Status + +Java Version | Status +------------ | ------ +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] +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://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 +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-language/java8-win.svg +[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-stable-green +[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-language.svg +[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-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/google-cloud-language/.repo-metadata.json b/google-cloud-language/.repo-metadata.json deleted file mode 100644 index df1cd93d..00000000 --- a/google-cloud-language/.repo-metadata.json +++ /dev/null @@ -1,13 +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-clients/latest/index.html?com/google/cloud/language/v1/package-summary.html", - "issue_tracker": "https://issuetracker.google.com/savedsearches/559753", - "release_level": "ga", - "language": "java", - "repo": "googleapis/google-cloud-java", - "repo_short": "google-cloud-java", - "distribution_name": "com.google.cloud:google-cloud-language", - "api_id": "language.googleapis.com" -} \ No newline at end of file diff --git a/google-cloud-language/README.md b/google-cloud-language/README.md deleted file mode 100644 index 3fa95dce..00000000 --- a/google-cloud-language/README.md +++ /dev/null @@ -1,130 +0,0 @@ -Google Cloud Java Client for Natural Language -====================================== - -Java idiomatic client for [Google Cloud Natural Language][cloud-language]. - -[![Kokoro CI](http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/master.svg)](http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/master.html) -[![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-language.svg)](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-language.svg) -[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/google-cloud-java) - -- [Product Documentation][language-product-docs] -- [Client Library Documentation][language-client-lib-docs] - -Quickstart ----------- - -[//]: # ({x-version-update-start:google-cloud-language:released}) -If you are using Maven, add this to your pom.xml file -```xml - - com.google.cloud - google-cloud-language - 1.98.0 - -``` -If you are using Gradle, add this to your dependencies -```Groovy -compile 'com.google.cloud:google-cloud-language:1.98.0' -``` -If you are using SBT, add this to your dependencies -```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-language" % "1.98.0" -``` -[//]: # ({x-version-update-end}) - -Authentication --------------- - -See the [Authentication](https://github.com/googleapis/google-cloud-java#authentication) section in the base directory's README. - -About Google Cloud Natural Language ----------------------------- - -Google [Cloud Natural Language API][cloud-language] provides natural language understanding technologies to developers, including sentiment analysis, entity analysis, and syntax analysis. This API is part of the larger Cloud Machine Learning API family. - -See the [Natural Language client library docs][language-client-lib-docs] to learn how to use this Cloud Natural Language API Client Library. - -Getting Started ---------------- -#### Prerequisites -You will need a [Google Developers Console](https://console.developers.google.com/) project with the Natural Language API enabled. [Follow these instructions](https://cloud.google.com/resource-manager/docs/creating-managing-projects) to get your project set up. You will also need to set up the local development environment by [installing the Google Cloud SDK](https://cloud.google.com/sdk/) and running the following commands in command line: `gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. - -#### Installation and setup -You'll need to obtain the `google-cloud-language` library. See the [Quickstart](#quickstart) section to add `google-cloud-language` as a dependency in your code. - -#### 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](../../google-cloud-examples/src/main/java/com/google/cloud/examples/language/snippets/AnalyzeSentiment.java) we put the code shown above into a complete program. - -Troubleshooting ---------------- - -To get help, follow the instructions in the [shared Troubleshooting document](https://github.com/googleapis/google-cloud-common/blob/master/troubleshooting/readme.md#troubleshooting). - -Transport ---------- -Language uses gRPC for the transport layer. - -Java Versions -------------- - -Java 7 or above is required for using this client. - -Versioning ----------- - -This library follows [Semantic Versioning](http://semver.org/). - -It is currently in major version one (``1.y.z``), which means that the public API should be considered stable. - -Contributing ------------- - -Contributions to this library are always welcome and highly encouraged. - -See `google-cloud`'s [CONTRIBUTING] documentation and the [shared documentation](https://github.com/googleapis/google-cloud-common/blob/master/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started. - -Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information. - -License -------- - -Apache 2.0 - See [LICENSE] for more information. - - -[CONTRIBUTING]:https://github.com/googleapis/google-cloud-java/blob/master/CONTRIBUTING.md -[code-of-conduct]:https://github.com/googleapis/google-cloud-java/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct -[LICENSE]: https://github.com/googleapis/google-cloud-java/blob/master/LICENSE -[cloud-platform]: https://cloud.google.com/ -[cloud-language]: https://cloud.google.com/natural-language/ -[language-product-docs]: https://cloud.google.com/natural-language/docs/ -[language-client-lib-docs]: https://googleapis.dev/java/google-cloud-clients/latest/index.html?com/google/cloud/language/v1beta2/package-summary.html diff --git a/google-cloud-language/pom.xml b/google-cloud-language/pom.xml deleted file mode 100644 index 3a85bb2c..00000000 --- a/google-cloud-language/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - 4.0.0 - google-cloud-language - 1.98.1-SNAPSHOT - jar - Google Cloud Natural Language - https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-language - - - Java idiomatic client for Google Cloud Natural Language. - - - com.google.cloud - google-cloud-clients - 0.116.1-alpha-SNAPSHOT - - - google-cloud-language - - - - ${project.groupId} - google-cloud-core-grpc - - - com.google.api.grpc - proto-google-cloud-language-v1 - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - - - - - 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 - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - protected - true - none - true - - - ${project.javadoc.protobufBaseURL} - ../../../../../google-api-grpc/proto-google-cloud-language-v1/target/site/apidocs/ - - - ${project.javadoc.protobufBaseURL} - ../../../../../google-api-grpc/grpc-google-cloud-language-v1/target/site/apidocs/ - - - ${project.javadoc.protobufBaseURL} - ../../../../../google-api-grpc/proto-google-cloud-language-v1beta2/target/site/apidocs/ - - - ${project.javadoc.protobufBaseURL} - ../../../../../google-api-grpc/grpc-google-cloud-language-v1beta2/target/site/apidocs/ - - - - - - - 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 d2db5d05..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java +++ /dev/null @@ -1,763 +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.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 SERVICE -/** - * 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: - * - *

- * 
- * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
- *   Document document = Document.newBuilder().build();
- *   EncodingType encodingType = EncodingType.NONE;
- *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document, encodingType);
- * }
- * 
- * 
- * - *

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

- * 
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * 
- * 
- * - * To customize the endpoint: - * - *
- * 
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * 
- * 
- */ -@Generated("by gapic-generator") -@BetaApi -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 to use 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSentimentRequest request = AnalyzeSentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSentimentRequest request = AnalyzeSentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeSentimentResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeEntitiesResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitySentimentRequest request = AnalyzeEntitySentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitySentimentRequest request = AnalyzeEntitySentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeEntitySentimentResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeSyntaxResponse> 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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<ClassifyTextResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   AnnotateTextRequest request = AnnotateTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .setFeatures(features)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   AnnotateTextRequest request = AnnotateTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .setFeatures(features)
-   *     .build();
-   *   ApiFuture<AnnotateTextResponse> 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 a42e4c9a..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java +++ /dev/null @@ -1,234 +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.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: - * - *

- * 
- * LanguageServiceSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceSettings.newBuilder();
- * languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * LanguageServiceSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by gapic-generator") -@BetaApi -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)); - } - - private static Builder createDefault() { - return new Builder(LanguageServiceStubSettings.newBuilder()); - } - - protected Builder(LanguageServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(LanguageServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - 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 a6797301..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java +++ /dev/null @@ -1,42 +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. - */ - -/** - * A client to Cloud Natural Language API. - * - *

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

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

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

Sample for LanguageServiceClient: - * - *

- * 
- * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
- *   Document document = Document.newBuilder().build();
- *   EncodingType encodingType = EncodingType.NONE;
- *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document, encodingType);
- * }
- * 
- * 
- */ -@Generated("by gapic-generator") -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 8687a1d4..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java +++ /dev/null @@ -1,115 +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.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.grpc.GrpcCallSettings; -import com.google.api.gax.grpc.GrpcCallableFactory; -import com.google.api.gax.grpc.GrpcStubCallableFactory; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientStreamingCallable; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.StreamingCallSettings; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS -/** - * gRPC callable factory implementation for Cloud Natural Language API. - * - *

This class is for advanced usage. - */ -@Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") -public class 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 pagedCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); - } - - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); - } -} diff --git a/google-cloud-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 a3fdfc81..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java +++ /dev/null @@ -1,275 +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.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.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 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 Cloud Natural Language API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") -public class 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 BackgroundResource backgroundResources; - - 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 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; - - 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); - - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - 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 5bf82d77..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java +++ /dev/null @@ -1,73 +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.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.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 Cloud Natural Language API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") -public abstract class 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 a9258d7a..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java +++ /dev/null @@ -1,416 +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.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: - * - *

- * 
- * LanguageServiceStubSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceStubSettings.newBuilder();
- * languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * LanguageServiceStubSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by gapic-generator") -@BetaApi -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); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); - } - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "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( - "idempotent", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(20000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(20000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) - .build(); - definitions.put("default", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - 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); - } - - 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("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .analyzeEntitiesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .analyzeEntitySentimentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .analyzeSyntaxSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .classifyTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .annotateTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - return builder; - } - - 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); - } - - // 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 e05ff9f5..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java +++ /dev/null @@ -1,634 +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.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 SERVICE -/** - * 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: - * - *

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

- * 
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * 
- * 
- * - * To customize the endpoint: - * - *
- * 
- * LanguageServiceSettings languageServiceSettings =
- *     LanguageServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
- * LanguageServiceClient languageServiceClient =
- *     LanguageServiceClient.create(languageServiceSettings);
- * 
- * 
- */ -@Generated("by gapic-generator") -@BetaApi -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 to use 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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSentimentRequest request = AnalyzeSentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSentimentRequest request = AnalyzeSentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeSentimentResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeEntitiesResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitySentimentRequest request = AnalyzeEntitySentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeEntitySentimentRequest request = AnalyzeEntitySentimentRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeEntitySentimentResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnalyzeSyntaxRequest request = AnalyzeSyntaxRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<AnalyzeSyntaxResponse> 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: - * - *


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


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .build();
-   *   ApiFuture<ClassifyTextResponse> 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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   EncodingType encodingType = EncodingType.NONE;
-   *   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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   AnnotateTextRequest request = AnnotateTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .setFeatures(features)
-   *     .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: - * - *


-   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
-   *   Document document = Document.newBuilder().build();
-   *   AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build();
-   *   AnnotateTextRequest request = AnnotateTextRequest.newBuilder()
-   *     .setDocument(document)
-   *     .setFeatures(features)
-   *     .build();
-   *   ApiFuture<AnnotateTextResponse> 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 6e148767..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceSettings.java +++ /dev/null @@ -1,234 +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.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: - * - *

- * 
- * LanguageServiceSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceSettings.newBuilder();
- * languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * LanguageServiceSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by gapic-generator") -@BetaApi -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)); - } - - private static Builder createDefault() { - return new Builder(LanguageServiceStubSettings.newBuilder()); - } - - protected Builder(LanguageServiceSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(LanguageServiceStubSettings.Builder stubSettings) { - super(stubSettings); - } - - 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 0596b7ef..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/package-info.java +++ /dev/null @@ -1,41 +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. - */ - -/** - * A client to Google Cloud Natural Language API. - * - *

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

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

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

Sample for LanguageServiceClient: - * - *

- * 
- * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
- *   Document document = Document.newBuilder().build();
- *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
- * }
- * 
- * 
- */ -@Generated("by gapic-generator") -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 74ad32fd..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceCallableFactory.java +++ /dev/null @@ -1,115 +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.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.stub.OperationsStub; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS -/** - * gRPC callable factory implementation for Google Cloud Natural Language API. - * - *

This class is for advanced usage. - */ -@Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") -public class 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 pagedCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); - } - - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - @Override - public - OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); - } - - @Override - public - BidiStreamingCallable createBidiStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); - } - - @Override - public - ClientStreamingCallable createClientStreamingCallable( - GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, - ClientContext clientContext) { - return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); - } -} diff --git a/google-cloud-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 5f28aee4..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceStub.java +++ /dev/null @@ -1,276 +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.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 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 Google Cloud Natural Language API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") -public class 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 BackgroundResource backgroundResources; - - 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 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; - - 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); - - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - 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 67c5f665..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStub.java +++ /dev/null @@ -1,73 +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.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 Google Cloud Natural Language API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") -public abstract class 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 d18f7e77..00000000 --- a/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStubSettings.java +++ /dev/null @@ -1,413 +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.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: - * - *

- * 
- * LanguageServiceStubSettings.Builder languageServiceSettingsBuilder =
- *     LanguageServiceStubSettings.newBuilder();
- * languageServiceSettingsBuilder.analyzeSentimentSettings().getRetrySettings().toBuilder()
- *     .setTotalTimeout(Duration.ofSeconds(30));
- * LanguageServiceStubSettings languageServiceSettings = languageServiceSettingsBuilder.build();
- * 
- * 
- */ -@Generated("by gapic-generator") -@BetaApi -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-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); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); - } - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return InstantiatingExecutorProvider.newBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return "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( - "idempotent", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(60000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(60000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) - .build(); - definitions.put("default", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this((ClientContext) null); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - 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); - } - - 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("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .analyzeEntitiesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .analyzeEntitySentimentSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .analyzeSyntaxSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .classifyTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .annotateTextSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - return builder; - } - - 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); - } - - // 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/v1/LanguageServiceClientTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java deleted file mode 100644 index 1541fa18..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java +++ /dev/null @@ -1,536 +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.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.Status; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class LanguageServiceClientTest { - private static MockLanguageService mockLanguageService; - private static MockServiceHelper serviceHelper; - private LanguageServiceClient client; - private LocalChannelProvider channelProvider; - - @BeforeClass - public static void startStaticServer() { - mockLanguageService = new MockLanguageService(); - serviceHelper = - new MockServiceHelper("in-process-1", Arrays.asList(mockLanguageService)); - serviceHelper.start(); - } - - @AfterClass - public static void stopServer() { - serviceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); - LanguageServiceSettings settings = - LanguageServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = LanguageServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - @SuppressWarnings("all") - public void analyzeSentimentTest() { - String language = "language-1613589672"; - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void analyzeSentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.analyzeSentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void analyzeSentimentTest2() { - String language = "language-1613589672"; - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder().setLanguage(language).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 - @SuppressWarnings("all") - public void analyzeSentimentExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - @SuppressWarnings("all") - public void analyzeEntitiesTest() { - String language = "language-1613589672"; - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void analyzeEntitiesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.analyzeEntities(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void analyzeEntitiesTest2() { - String language = "language-1613589672"; - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder().setLanguage(language).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 - @SuppressWarnings("all") - public void analyzeEntitiesExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - @SuppressWarnings("all") - public void analyzeEntitySentimentTest() { - String language = "language-1613589672"; - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void analyzeEntitySentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.analyzeEntitySentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void analyzeEntitySentimentTest2() { - String language = "language-1613589672"; - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder().setLanguage(language).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 - @SuppressWarnings("all") - public void analyzeEntitySentimentExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - @SuppressWarnings("all") - public void analyzeSyntaxTest() { - String language = "language-1613589672"; - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void analyzeSyntaxExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.analyzeSyntax(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void analyzeSyntaxTest2() { - String language = "language-1613589672"; - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder().setLanguage(language).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 - @SuppressWarnings("all") - public void analyzeSyntaxExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - @SuppressWarnings("all") - public void classifyTextTest() { - ClassifyTextResponse expectedResponse = ClassifyTextResponse.newBuilder().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 - @SuppressWarnings("all") - public void classifyTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - @SuppressWarnings("all") - public void annotateTextTest() { - String language = "language-1613589672"; - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void annotateTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.annotateText(document, features, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void annotateTextTest2() { - String language = "language-1613589672"; - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder().setLanguage(language).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 - @SuppressWarnings("all") - public void annotateTextExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - } - } -} 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 649f8e1a..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java +++ /dev/null @@ -1,57 +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.api.core.BetaApi; -import com.google.api.gax.grpc.testing.MockGrpcService; -import com.google.protobuf.AbstractMessage; -import io.grpc.ServerServiceDefinition; -import java.util.List; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -public class 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 b52e224d..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java +++ /dev/null @@ -1,149 +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.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; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -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 88793b18..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientTest.java +++ /dev/null @@ -1,329 +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.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.Status; -import io.grpc.StatusRuntimeException; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -@javax.annotation.Generated("by GAPIC") -public class LanguageServiceClientTest { - private static MockLanguageService mockLanguageService; - private static MockServiceHelper serviceHelper; - private LanguageServiceClient client; - private LocalChannelProvider channelProvider; - - @BeforeClass - public static void startStaticServer() { - mockLanguageService = new MockLanguageService(); - serviceHelper = - new MockServiceHelper("in-process-1", Arrays.asList(mockLanguageService)); - serviceHelper.start(); - } - - @AfterClass - public static void stopServer() { - serviceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); - LanguageServiceSettings settings = - LanguageServiceSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = LanguageServiceClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - @SuppressWarnings("all") - public void analyzeSentimentTest() { - String language = "language-1613589672"; - AnalyzeSentimentResponse expectedResponse = - AnalyzeSentimentResponse.newBuilder().setLanguage(language).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 - @SuppressWarnings("all") - public void analyzeSentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - @SuppressWarnings("all") - public void analyzeEntitiesTest() { - String language = "language-1613589672"; - AnalyzeEntitiesResponse expectedResponse = - AnalyzeEntitiesResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void analyzeEntitiesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.analyzeEntities(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void analyzeEntitySentimentTest() { - String language = "language-1613589672"; - AnalyzeEntitySentimentResponse expectedResponse = - AnalyzeEntitySentimentResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void analyzeEntitySentimentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.analyzeEntitySentiment(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void analyzeSyntaxTest() { - String language = "language-1613589672"; - AnalyzeSyntaxResponse expectedResponse = - AnalyzeSyntaxResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void analyzeSyntaxExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - client.analyzeSyntax(document, encodingType); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void classifyTextTest() { - ClassifyTextResponse expectedResponse = ClassifyTextResponse.newBuilder().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 - @SuppressWarnings("all") - public void classifyTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(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 - @SuppressWarnings("all") - public void annotateTextTest() { - String language = "language-1613589672"; - AnnotateTextResponse expectedResponse = - AnnotateTextResponse.newBuilder().setLanguage(language).build(); - mockLanguageService.addResponse(expectedResponse); - - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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 - @SuppressWarnings("all") - public void annotateTextExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockLanguageService.addException(exception); - - try { - Document document = Document.newBuilder().build(); - AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); - EncodingType encodingType = EncodingType.NONE; - - 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/LanguageServiceSmokeTest.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceSmokeTest.java deleted file mode 100644 index 1e120297..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/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.v1beta2; - -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/v1beta2/MockLanguageService.java b/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageService.java deleted file mode 100644 index 8d4bfef8..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageService.java +++ /dev/null @@ -1,57 +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.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; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -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 9908d1db..00000000 --- a/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageServiceImpl.java +++ /dev/null @@ -1,149 +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.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; - -@javax.annotation.Generated("by GAPIC") -@BetaApi -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/synth.metadata b/google-cloud-language/synth.metadata deleted file mode 100644 index 2b44db1a..00000000 --- a/google-cloud-language/synth.metadata +++ /dev/null @@ -1,42 +0,0 @@ -{ - "updateTime": "2019-10-01T07:45:14.743082Z", - "sources": [ - { - "generator": { - "name": "artman", - "version": "0.37.1", - "dockerImage": "googleapis/artman@sha256:6068f67900a3f0bdece596b97bda8fc70406ca0e137a941f4c81d3217c994a80" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "ce3c574d1266026cebea3a893247790bd68191c2", - "internalRef": "272147209" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "language", - "apiVersion": "v1", - "language": "java", - "generator": "gapic", - "config": "google/cloud/language/artman_language_v1.yaml" - } - }, - { - "client": { - "source": "googleapis", - "apiName": "language", - "apiVersion": "v1beta2", - "language": "java", - "generator": "gapic", - "config": "google/cloud/language/artman_language_v1beta2.yaml" - } - } - ] -} \ No newline at end of file diff --git a/google-cloud-language/synth.py b/google-cloud-language/synth.py deleted file mode 100644 index ab390278..00000000 --- a/google-cloud-language/synth.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""This script is used to synthesize generated parts of this library.""" - -import synthtool as s -import synthtool.gcp as gcp -import synthtool.languages.java as java - -gapic = gcp.GAPICGenerator() - -service = 'language' -versions = ['v1', 'v1beta2'] -config_pattern = '/google/cloud/language/artman_language_{version}.yaml' - -for version in versions: - library = gapic.java_library( - service=service, - version=version, - config_path=config_pattern.format(version=version), - artman_output_name='') - - s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') - s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') - - java.format_code('./src') - java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') - java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/grpc-google-cloud-language-v1/pom.xml b/grpc-google-cloud-language-v1/pom.xml deleted file mode 100644 index 363dc3f9..00000000 --- a/grpc-google-cloud-language-v1/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - grpc-google-cloud-language-v1 - 1.80.1-SNAPSHOT - grpc-google-cloud-language-v1 - GRPC library for grpc-google-cloud-language-v1 - - com.google.api.grpc - google-api-grpc - 0.81.1-SNAPSHOT - - - - io.grpc - grpc-stub - compile - - - io.grpc - grpc-protobuf - compile - - - com.google.api.grpc - proto-google-cloud-language-v1 - compile - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - protected - true - none - true - - - ${project.javadoc.protobufBaseURL} - ../../../../proto-google-cloud-language-v1/target/site/apidocs/ - - - - - - - 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 b919dd07..00000000 --- a/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java +++ /dev/null @@ -1,1043 +0,0 @@ -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 (version 1.10.0)", - 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. - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeSentimentMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse> - METHOD_ANALYZE_SENTIMENT = getAnalyzeSentimentMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod() { - return getAnalyzeSentimentMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse> - getAnalyzeSentimentMethodHelper() { - 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( - "google.cloud.language.v1.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeEntitiesMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - METHOD_ANALYZE_ENTITIES = getAnalyzeEntitiesMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod() { - return getAnalyzeEntitiesMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethodHelper() { - 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( - "google.cloud.language.v1.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeEntitySentimentMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - METHOD_ANALYZE_ENTITY_SENTIMENT = getAnalyzeEntitySentimentMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod() { - return getAnalyzeEntitySentimentMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethodHelper() { - 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( - "google.cloud.language.v1.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeSyntaxMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - METHOD_ANALYZE_SYNTAX = getAnalyzeSyntaxMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod() { - return getAnalyzeSyntaxMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethodHelper() { - 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( - "google.cloud.language.v1.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getClassifyTextMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse> - METHOD_CLASSIFY_TEXT = getClassifyTextMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse> - getClassifyTextMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse> - getClassifyTextMethod() { - return getClassifyTextMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse> - getClassifyTextMethodHelper() { - 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( - "google.cloud.language.v1.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnnotateTextMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse> - METHOD_ANNOTATE_TEXT = getAnnotateTextMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse> - getAnnotateTextMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse> - getAnnotateTextMethod() { - return getAnnotateTextMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1.AnnotateTextRequest, - com.google.cloud.language.v1.AnnotateTextResponse> - getAnnotateTextMethodHelper() { - 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( - "google.cloud.language.v1.LanguageService", "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) { - return new LanguageServiceStub(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) { - return new LanguageServiceBlockingStub(channel); - } - - /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static LanguageServiceFutureStub newFutureStub(io.grpc.Channel channel) { - return new LanguageServiceFutureStub(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(getAnalyzeSentimentMethodHelper(), 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(getAnalyzeEntitiesMethodHelper(), 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(getAnalyzeEntitySentimentMethodHelper(), 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(getAnalyzeSyntaxMethodHelper(), responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - asyncUnimplementedUnaryCall(getClassifyTextMethodHelper(), 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(getAnnotateTextMethodHelper(), responseObserver); - } - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getAnalyzeSentimentMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeSentimentRequest, - com.google.cloud.language.v1.AnalyzeSentimentResponse>( - this, METHODID_ANALYZE_SENTIMENT))) - .addMethod( - getAnalyzeEntitiesMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeEntitiesRequest, - com.google.cloud.language.v1.AnalyzeEntitiesResponse>( - this, METHODID_ANALYZE_ENTITIES))) - .addMethod( - getAnalyzeEntitySentimentMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>( - this, METHODID_ANALYZE_ENTITY_SENTIMENT))) - .addMethod( - getAnalyzeSyntaxMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.AnalyzeSyntaxRequest, - com.google.cloud.language.v1.AnalyzeSyntaxResponse>( - this, METHODID_ANALYZE_SYNTAX))) - .addMethod( - getClassifyTextMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1.ClassifyTextRequest, - com.google.cloud.language.v1.ClassifyTextResponse>( - this, METHODID_CLASSIFY_TEXT))) - .addMethod( - getAnnotateTextMethodHelper(), - 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.AbstractStub { - private LanguageServiceStub(io.grpc.Channel channel) { - super(channel); - } - - 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(getAnalyzeSentimentMethodHelper(), 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(getAnalyzeEntitiesMethodHelper(), 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(getAnalyzeEntitySentimentMethodHelper(), 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(getAnalyzeSyntaxMethodHelper(), 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(getClassifyTextMethodHelper(), 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(getAnnotateTextMethodHelper(), getCallOptions()), - request, - responseObserver); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceBlockingStub - extends io.grpc.stub.AbstractStub { - private LanguageServiceBlockingStub(io.grpc.Channel channel) { - super(channel); - } - - 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(), getAnalyzeSentimentMethodHelper(), 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(), getAnalyzeEntitiesMethodHelper(), 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(), getAnalyzeEntitySentimentMethodHelper(), 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(), getAnalyzeSyntaxMethodHelper(), 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(), getClassifyTextMethodHelper(), 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(), getAnnotateTextMethodHelper(), getCallOptions(), request); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceFutureStub - extends io.grpc.stub.AbstractStub { - private LanguageServiceFutureStub(io.grpc.Channel channel) { - super(channel); - } - - 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(getAnalyzeSentimentMethodHelper(), 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(getAnalyzeEntitiesMethodHelper(), 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(getAnalyzeEntitySentimentMethodHelper(), 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(getAnalyzeSyntaxMethodHelper(), 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(getClassifyTextMethodHelper(), 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(getAnnotateTextMethodHelper(), 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(getAnalyzeSentimentMethodHelper()) - .addMethod(getAnalyzeEntitiesMethodHelper()) - .addMethod(getAnalyzeEntitySentimentMethodHelper()) - .addMethod(getAnalyzeSyntaxMethodHelper()) - .addMethod(getClassifyTextMethodHelper()) - .addMethod(getAnnotateTextMethodHelper()) - .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 436e174a..00000000 --- a/grpc-google-cloud-language-v1beta2/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - grpc-google-cloud-language-v1beta2 - 0.81.1-SNAPSHOT - grpc-google-cloud-language-v1beta2 - GRPC library for grpc-google-cloud-language-v1beta2 - - com.google.api.grpc - google-api-grpc - 0.81.1-SNAPSHOT - - - - io.grpc - grpc-stub - compile - - - io.grpc - grpc-protobuf - compile - - - com.google.api.grpc - proto-google-cloud-language-v1beta2 - compile - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - protected - true - none - true - - - ${project.javadoc.protobufBaseURL} - ../../../../proto-google-cloud-language-v1beta2/target/site/apidocs/ - - - - - - - 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 6299088a..00000000 --- a/grpc-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceGrpc.java +++ /dev/null @@ -1,1049 +0,0 @@ -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 (version 1.10.0)", - 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. - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeSentimentMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - METHOD_ANALYZE_SENTIMENT = getAnalyzeSentimentMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - getAnalyzeSentimentMethod() { - return getAnalyzeSentimentMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse> - getAnalyzeSentimentMethodHelper() { - 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( - "google.cloud.language.v1beta2.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeEntitiesMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - METHOD_ANALYZE_ENTITIES = getAnalyzeEntitiesMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethod() { - return getAnalyzeEntitiesMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse> - getAnalyzeEntitiesMethodHelper() { - 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( - "google.cloud.language.v1beta2.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeEntitySentimentMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - METHOD_ANALYZE_ENTITY_SENTIMENT = getAnalyzeEntitySentimentMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethod() { - return getAnalyzeEntitySentimentMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse> - getAnalyzeEntitySentimentMethodHelper() { - 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( - "google.cloud.language.v1beta2.LanguageService", - "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnalyzeSyntaxMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - METHOD_ANALYZE_SYNTAX = getAnalyzeSyntaxMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethod() { - return getAnalyzeSyntaxMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse> - getAnalyzeSyntaxMethodHelper() { - 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( - "google.cloud.language.v1beta2.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getClassifyTextMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse> - METHOD_CLASSIFY_TEXT = getClassifyTextMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse> - getClassifyTextMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse> - getClassifyTextMethod() { - return getClassifyTextMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse> - getClassifyTextMethodHelper() { - 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( - "google.cloud.language.v1beta2.LanguageService", "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; - } - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - @java.lang.Deprecated // Use {@link #getAnnotateTextMethod()} instead. - public static final io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse> - METHOD_ANNOTATE_TEXT = getAnnotateTextMethodHelper(); - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse> - getAnnotateTextMethod; - - @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") - public static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse> - getAnnotateTextMethod() { - return getAnnotateTextMethodHelper(); - } - - private static io.grpc.MethodDescriptor< - com.google.cloud.language.v1beta2.AnnotateTextRequest, - com.google.cloud.language.v1beta2.AnnotateTextResponse> - getAnnotateTextMethodHelper() { - 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( - "google.cloud.language.v1beta2.LanguageService", "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) { - return new LanguageServiceStub(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) { - return new LanguageServiceBlockingStub(channel); - } - - /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static LanguageServiceFutureStub newFutureStub(io.grpc.Channel channel) { - return new LanguageServiceFutureStub(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(getAnalyzeSentimentMethodHelper(), 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(getAnalyzeEntitiesMethodHelper(), 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(getAnalyzeEntitySentimentMethodHelper(), 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(getAnalyzeSyntaxMethodHelper(), responseObserver); - } - - /** - * - * - *
-     * Classifies a document into categories.
-     * 
- */ - public void classifyText( - com.google.cloud.language.v1beta2.ClassifyTextRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - asyncUnimplementedUnaryCall(getClassifyTextMethodHelper(), 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(getAnnotateTextMethodHelper(), responseObserver); - } - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getAnalyzeSentimentMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeSentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeSentimentResponse>( - this, METHODID_ANALYZE_SENTIMENT))) - .addMethod( - getAnalyzeEntitiesMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeEntitiesRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitiesResponse>( - this, METHODID_ANALYZE_ENTITIES))) - .addMethod( - getAnalyzeEntitySentimentMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentRequest, - com.google.cloud.language.v1beta2.AnalyzeEntitySentimentResponse>( - this, METHODID_ANALYZE_ENTITY_SENTIMENT))) - .addMethod( - getAnalyzeSyntaxMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest, - com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse>( - this, METHODID_ANALYZE_SYNTAX))) - .addMethod( - getClassifyTextMethodHelper(), - asyncUnaryCall( - new MethodHandlers< - com.google.cloud.language.v1beta2.ClassifyTextRequest, - com.google.cloud.language.v1beta2.ClassifyTextResponse>( - this, METHODID_CLASSIFY_TEXT))) - .addMethod( - getAnnotateTextMethodHelper(), - 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.AbstractStub { - private LanguageServiceStub(io.grpc.Channel channel) { - super(channel); - } - - 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(getAnalyzeSentimentMethodHelper(), 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(getAnalyzeEntitiesMethodHelper(), 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(getAnalyzeEntitySentimentMethodHelper(), 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(getAnalyzeSyntaxMethodHelper(), 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(getClassifyTextMethodHelper(), 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(getAnnotateTextMethodHelper(), getCallOptions()), - request, - responseObserver); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceBlockingStub - extends io.grpc.stub.AbstractStub { - private LanguageServiceBlockingStub(io.grpc.Channel channel) { - super(channel); - } - - 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(), getAnalyzeSentimentMethodHelper(), 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(), getAnalyzeEntitiesMethodHelper(), 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(), getAnalyzeEntitySentimentMethodHelper(), 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(), getAnalyzeSyntaxMethodHelper(), 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(), getClassifyTextMethodHelper(), 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(), getAnnotateTextMethodHelper(), getCallOptions(), request); - } - } - - /** - * - * - *
-   * Provides text analysis operations such as sentiment analysis and entity
-   * recognition.
-   * 
- */ - public static final class LanguageServiceFutureStub - extends io.grpc.stub.AbstractStub { - private LanguageServiceFutureStub(io.grpc.Channel channel) { - super(channel); - } - - 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(getAnalyzeSentimentMethodHelper(), 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(getAnalyzeEntitiesMethodHelper(), 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(getAnalyzeEntitySentimentMethodHelper(), 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(getAnalyzeSyntaxMethodHelper(), 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(getClassifyTextMethodHelper(), 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(getAnnotateTextMethodHelper(), 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(getAnalyzeSentimentMethodHelper()) - .addMethod(getAnalyzeEntitiesMethodHelper()) - .addMethod(getAnalyzeEntitySentimentMethodHelper()) - .addMethod(getAnalyzeSyntaxMethodHelper()) - .addMethod(getClassifyTextMethodHelper()) - .addMethod(getAnnotateTextMethodHelper()) - .build(); - } - } - } - return result; - } -} diff --git a/proto-google-cloud-language-v1/pom.xml b/proto-google-cloud-language-v1/pom.xml deleted file mode 100644 index d53caf09..00000000 --- a/proto-google-cloud-language-v1/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - 4.0.0 - proto-google-cloud-language-v1 - 1.80.1-SNAPSHOT - proto-google-cloud-language-v1 - PROTO library for proto-google-cloud-language-v1 - - com.google.api.grpc - google-api-grpc - 0.81.1-SNAPSHOT - - - - com.google.protobuf - protobuf-java - compile - - - com.google.api.grpc - proto-google-common-protos - compile - - - \ 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 6b12b3d3..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java +++ /dev/null @@ -1,856 +0,0 @@ -// 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 - 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(); - } - 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.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]; - * - */ - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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]; - * - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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; - */ - 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; - */ - 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; - */ - 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 393cca04..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java +++ /dev/null @@ -1,68 +0,0 @@ -// 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]; - * - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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 dabd7026..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java +++ /dev/null @@ -1,1100 +0,0 @@ -// 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 - 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); - } - - private int bitField0_; - 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; - */ - public java.util.List getEntitiesList() { - return entities_; - } - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public java.util.List - getEntitiesOrBuilderList() { - return entities_; - } - /** - * - * - *
-   * The recognized entities in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Entity entities = 1; - */ - public int getEntitiesCount() { - return entities_.size(); - } - /** - * - * - *
-   * 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) { - return entities_.get(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) { - 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; - */ - 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; - */ - 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_; - int to_bitField0_ = 0; - 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_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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 0ba181d5..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java +++ /dev/null @@ -1,86 +0,0 @@ -// 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; - */ - 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; - */ - 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 751432c8..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java +++ /dev/null @@ -1,857 +0,0 @@ -// 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 - 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(); - } - 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.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]; - * - */ - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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]; - * - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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; - */ - 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; - */ - 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; - */ - 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 2f5ad809..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java +++ /dev/null @@ -1,68 +0,0 @@ -// 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]; - * - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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 5ef7084f..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java +++ /dev/null @@ -1,1102 +0,0 @@ -// 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 - 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); - } - - private int bitField0_; - 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; - */ - 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; - */ - 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; - */ - public int getEntitiesCount() { - return entities_.size(); - } - /** - * - * - *
-   * 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) { - return entities_.get(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) { - 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; - */ - 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; - */ - 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_; - int to_bitField0_ = 0; - 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_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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 6a507adb..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java +++ /dev/null @@ -1,86 +0,0 @@ -// 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; - */ - 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; - */ - 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 2c862fcc..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java +++ /dev/null @@ -1,856 +0,0 @@ -// 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 - 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(); - } - 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.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]; - * - */ - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate sentence offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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]; - * - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate sentence offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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; - */ - 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; - */ - 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; - */ - 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 9f3cff27..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java +++ /dev/null @@ -1,68 +0,0 @@ -// 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]; - * - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate sentence offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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 b72367d9..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java +++ /dev/null @@ -1,1368 +0,0 @@ -// 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 - 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_ & 0x00000004) != 0)) { - sentences_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000004; - } - 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_ & 0x00000004) != 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); - } - - private int bitField0_; - 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; - */ - public boolean hasDocumentSentiment() { - return documentSentiment_ != null; - } - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - public java.util.List getSentencesList() { - return sentences_; - } - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public java.util.List - getSentencesOrBuilderList() { - return sentences_; - } - /** - * - * - *
-   * The sentiment for all the sentences in the document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 3; - */ - public int getSentencesCount() { - return sentences_.size(); - } - /** - * - * - *
-   * 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) { - return sentences_.get(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) { - 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_ & ~0x00000004); - } 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_; - int to_bitField0_ = 0; - if (documentSentimentBuilder_ == null) { - result.documentSentiment_ = documentSentiment_; - } else { - result.documentSentiment_ = documentSentimentBuilder_.build(); - } - result.language_ = language_; - if (sentencesBuilder_ == null) { - if (((bitField0_ & 0x00000004) != 0)) { - sentences_ = java.util.Collections.unmodifiableList(sentences_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.sentences_ = sentences_; - } else { - result.sentences_ = sentencesBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.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_ & ~0x00000004); - } else { - ensureSentencesIsMutable(); - sentences_.addAll(other.sentences_); - } - onChanged(); - } - } else { - if (!other.sentences_.isEmpty()) { - if (sentencesBuilder_.isEmpty()) { - sentencesBuilder_.dispose(); - sentencesBuilder_ = null; - sentences_ = other.sentences_; - bitField0_ = (bitField0_ & ~0x00000004); - 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; - */ - public boolean hasDocumentSentiment() { - return documentSentimentBuilder_ != null || documentSentiment_ != null; - } - /** - * - * - *
-     * The overall sentiment of the input document.
-     * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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_ & 0x00000004) != 0)) { - sentences_ = new java.util.ArrayList(sentences_); - bitField0_ |= 0x00000004; - } - } - - 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_ & ~0x00000004); - 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_ & 0x00000004) != 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 e0b0030f..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java +++ /dev/null @@ -1,118 +0,0 @@ -// 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; - */ - boolean hasDocumentSentiment(); - /** - * - * - *
-   * The overall sentiment of the input document.
-   * 
- * - * .google.cloud.language.v1.Sentiment document_sentiment = 1; - */ - 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; - */ - 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; - */ - 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 23a1a41f..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java +++ /dev/null @@ -1,856 +0,0 @@ -// 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 - 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(); - } - 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.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]; - * - */ - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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]; - * - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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; - */ - 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; - */ - 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; - */ - 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 0c4e9c9f..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java +++ /dev/null @@ -1,68 +0,0 @@ -// 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]; - * - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 2; - */ - 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 128d92ea..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java +++ /dev/null @@ -1,1581 +0,0 @@ -// 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 - 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); - } - - private int bitField0_; - 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; - */ - public java.util.List getSentencesList() { - return sentences_; - } - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public java.util.List - getSentencesOrBuilderList() { - return sentences_; - } - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - public int getSentencesCount() { - return sentences_.size(); - } - /** - * - * - *
-   * Sentences in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.Sentence sentences = 1; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - public int getTokensCount() { - return tokens_.size(); - } - /** - * - * - *
-   * 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) { - return tokens_.get(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) { - 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; - */ - 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; - */ - 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_; - int to_bitField0_ = 0; - 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_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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 0db86a21..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// 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; - */ - 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; - */ - 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 b52194e9..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java +++ /dev/null @@ -1,2045 +0,0 @@ -// 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 - 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(); - } - 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.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; - */ - boolean getExtractSyntax(); - - /** - * - * - *
-     * Extract entities.
-     * 
- * - * bool extract_entities = 2; - */ - boolean getExtractEntities(); - - /** - * - * - *
-     * Extract document-level sentiment.
-     * 
- * - * bool extract_document_sentiment = 3; - */ - boolean getExtractDocumentSentiment(); - - /** - * - * - *
-     * Extract entities and their associated sentiment.
-     * 
- * - * bool extract_entity_sentiment = 4; - */ - boolean getExtractEntitySentiment(); - - /** - * - * - *
-     * Classify the full document into categories.
-     * 
- * - * bool classify_text = 6; - */ - 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 - 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(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - 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; - */ - public boolean getExtractSyntax() { - return extractSyntax_; - } - - public static final int EXTRACT_ENTITIES_FIELD_NUMBER = 2; - private boolean extractEntities_; - /** - * - * - *
-     * Extract entities.
-     * 
- * - * bool extract_entities = 2; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - public boolean getExtractSyntax() { - return extractSyntax_; - } - /** - * - * - *
-       * Extract syntax information.
-       * 
- * - * bool extract_syntax = 1; - */ - public Builder setExtractSyntax(boolean value) { - - extractSyntax_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract syntax information.
-       * 
- * - * bool extract_syntax = 1; - */ - public Builder clearExtractSyntax() { - - extractSyntax_ = false; - onChanged(); - return this; - } - - private boolean extractEntities_; - /** - * - * - *
-       * Extract entities.
-       * 
- * - * bool extract_entities = 2; - */ - public boolean getExtractEntities() { - return extractEntities_; - } - /** - * - * - *
-       * Extract entities.
-       * 
- * - * bool extract_entities = 2; - */ - public Builder setExtractEntities(boolean value) { - - extractEntities_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract entities.
-       * 
- * - * bool extract_entities = 2; - */ - public Builder clearExtractEntities() { - - extractEntities_ = false; - onChanged(); - return this; - } - - private boolean extractDocumentSentiment_; - /** - * - * - *
-       * Extract document-level sentiment.
-       * 
- * - * bool extract_document_sentiment = 3; - */ - public boolean getExtractDocumentSentiment() { - return extractDocumentSentiment_; - } - /** - * - * - *
-       * Extract document-level sentiment.
-       * 
- * - * bool extract_document_sentiment = 3; - */ - public Builder setExtractDocumentSentiment(boolean value) { - - extractDocumentSentiment_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract document-level sentiment.
-       * 
- * - * bool extract_document_sentiment = 3; - */ - public Builder clearExtractDocumentSentiment() { - - extractDocumentSentiment_ = false; - onChanged(); - return this; - } - - private boolean extractEntitySentiment_; - /** - * - * - *
-       * Extract entities and their associated sentiment.
-       * 
- * - * bool extract_entity_sentiment = 4; - */ - public boolean getExtractEntitySentiment() { - return extractEntitySentiment_; - } - /** - * - * - *
-       * Extract entities and their associated sentiment.
-       * 
- * - * bool extract_entity_sentiment = 4; - */ - public Builder setExtractEntitySentiment(boolean value) { - - extractEntitySentiment_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Extract entities and their associated sentiment.
-       * 
- * - * bool extract_entity_sentiment = 4; - */ - public Builder clearExtractEntitySentiment() { - - extractEntitySentiment_ = false; - onChanged(); - return this; - } - - private boolean classifyText_; - /** - * - * - *
-       * Classify the full document into categories.
-       * 
- * - * bool classify_text = 6; - */ - public boolean getClassifyText() { - return classifyText_; - } - /** - * - * - *
-       * Classify the full document into categories.
-       * 
- * - * bool classify_text = 6; - */ - public Builder setClassifyText(boolean value) { - - classifyText_ = value; - onChanged(); - return this; - } - /** - * - * - *
-       * Classify the full document into categories.
-       * 
- * - * bool classify_text = 6; - */ - 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]; - * - */ - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - 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]; - * - */ - public boolean hasFeatures() { - return features_ != null; - } - /** - * - * - *
-   * The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - */ - 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]; - * - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - public boolean hasFeatures() { - return featuresBuilder_ != null || features_ != null; - } - /** - * - * - *
-     * The enabled features.
-     * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - public int getEncodingTypeValue() { - return encodingType_; - } - /** - * - * - *
-     * The encoding type used by the API to calculate offsets.
-     * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - */ - 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; - */ - 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; - */ - 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; - */ - 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 ea5ea637..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java +++ /dev/null @@ -1,105 +0,0 @@ -// 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]; - * - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - boolean hasFeatures(); - /** - * - * - *
-   * The enabled features.
-   * 
- * - * - * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - */ - int getEncodingTypeValue(); - /** - * - * - *
-   * The encoding type used by the API to calculate offsets.
-   * 
- * - * .google.cloud.language.v1.EncodingType encoding_type = 3; - */ - 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 71fe2c60..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java +++ /dev/null @@ -1,2950 +0,0 @@ -// 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 - 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_ & 0x00000020) != 0)) { - categories_ = - new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; - } - 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_ & 0x00000020) != 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); - } - - private int bitField0_; - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - public java.util.List getCategoriesList() { - return categories_; - } - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public java.util.List - getCategoriesOrBuilderList() { - return categories_; - } - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - public int getCategoriesCount() { - return categories_.size(); - } - /** - * - * - *
-   * Categories identified in the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; - */ - 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; - */ - 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_ & ~0x00000020); - } 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_; - int to_bitField0_ = 0; - 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_ & 0x00000020) != 0)) { - categories_ = java.util.Collections.unmodifiableList(categories_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.categories_ = categories_; - } else { - result.categories_ = categoriesBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.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_ & ~0x00000020); - } else { - ensureCategoriesIsMutable(); - categories_.addAll(other.categories_); - } - onChanged(); - } - } else { - if (!other.categories_.isEmpty()) { - if (categoriesBuilder_.isEmpty()) { - categoriesBuilder_.dispose(); - categoriesBuilder_ = null; - categories_ = other.categories_; - bitField0_ = (bitField0_ & ~0x00000020); - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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_ & 0x00000020) != 0)) { - categories_ = - new java.util.ArrayList( - categories_); - bitField0_ |= 0x00000020; - } - } - - 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_ & ~0x00000020); - 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_ & 0x00000020) != 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 87e207ec..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java +++ /dev/null @@ -1,300 +0,0 @@ -// 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; - */ - 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; - */ - 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; - */ - 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; - */ - 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 ca0d2c4b..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java +++ /dev/null @@ -1,689 +0,0 @@ -// 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 - 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(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - java.lang.String s = input.readStringRequireUtf8(); - - name_ = s; - break; - } - case 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](/natural-language/docs/categories).
-   * 
- * - * string name = 1; - */ - 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](/natural-language/docs/categories).
-   * 
- * - * string name = 1; - */ - 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; - */ - 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](/natural-language/docs/categories).
-     * 
- * - * string name = 1; - */ - 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](/natural-language/docs/categories).
-     * 
- * - * string name = 1; - */ - 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](/natural-language/docs/categories).
-     * 
- * - * string name = 1; - */ - 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](/natural-language/docs/categories).
-     * 
- * - * string name = 1; - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * The name of the category representing the document, from the [predefined
-     * taxonomy](/natural-language/docs/categories).
-     * 
- * - * string name = 1; - */ - 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; - */ - 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; - */ - 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; - */ - 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 b2f2ba38..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -// 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](/natural-language/docs/categories).
-   * 
- * - * string name = 1; - */ - java.lang.String getName(); - /** - * - * - *
-   * The name of the category representing the document, from the [predefined
-   * taxonomy](/natural-language/docs/categories).
-   * 
- * - * string name = 1; - */ - 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; - */ - 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 2945d64d..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java +++ /dev/null @@ -1,725 +0,0 @@ -// 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 - 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(); - } - 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.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]; - * - */ - public boolean hasDocument() { - return document_ != null; - } - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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]; - * - */ - 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]; - * - */ - public boolean hasDocument() { - return documentBuilder_ != null || document_ != null; - } - /** - * - * - *
-     * Input document.
-     * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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 06f6fe26..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java +++ /dev/null @@ -1,47 +0,0 @@ -// 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]; - * - */ - boolean hasDocument(); - /** - * - * - *
-   * Input document.
-   * 
- * - * - * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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 9b504cf9..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java +++ /dev/null @@ -1,935 +0,0 @@ -// 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 - 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; - */ - public java.util.List getCategoriesList() { - return categories_; - } - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public java.util.List - getCategoriesOrBuilderList() { - return categories_; - } - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - public int getCategoriesCount() { - return categories_.size(); - } - /** - * - * - *
-   * Categories representing the input document.
-   * 
- * - * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; - */ - 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; - */ - 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 46e79cca..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java +++ /dev/null @@ -1,62 +0,0 @@ -// 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 0f0822f1..00000000 --- a/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java +++ /dev/null @@ -1,2570 +0,0 @@ -// 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 - 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(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - 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; - } - - /** @deprecated Use {@link #forNumber(int)} instead. */ - @java.lang.Deprecated - public static Label valueOf(int value) { - return forNumber(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