From 8935a04f3ea145ad3561e0de848f684acf19b080 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 23 Sep 2022 23:45:03 +0000 Subject: [PATCH 1/2] docs: fix docstring formatting Committer: @parthea PiperOrigin-RevId: 476410563 Source-Link: https://github.com/googleapis/googleapis/commit/7f579ee5968051f12c86a2ea50bcdeb1fbd5df94 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ae0240e097a196c070e15deaae66464b42c8e014 Copy-Tag: eyJwIjoiamF2YS1sYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiYWUwMjQwZTA5N2ExOTZjMDcwZTE1ZGVhYWU2NjQ2NGI0MmM4ZTAxNCJ9 --- .../language/v1/LanguageServiceClient.java | 913 ++++ .../language/v1/LanguageServiceSettings.java | 262 + .../cloud/language/v1/gapic_metadata.json | 36 + .../cloud/language/v1/package-info.java | 44 + .../GrpcLanguageServiceCallableFactory.java | 113 + .../v1/stub/GrpcLanguageServiceStub.java | 297 ++ ...ttpJsonLanguageServiceCallableFactory.java | 105 + .../v1/stub/HttpJsonLanguageServiceStub.java | 467 ++ .../language/v1/stub/LanguageServiceStub.java | 72 + .../v1/stub/LanguageServiceStubSettings.java | 469 ++ .../v1/LanguageServiceClientHttpJsonTest.java | 595 +++ .../v1/LanguageServiceClientTest.java | 542 ++ .../language/v1/MockLanguageService.java | 59 + .../language/v1/MockLanguageServiceImpl.java | 187 + .../language/v1/LanguageServiceGrpc.java | 762 +++ .../language/v1/AnalyzeEntitiesRequest.java | 789 +++ .../v1/AnalyzeEntitiesRequestOrBuilder.java | 55 + .../language/v1/AnalyzeEntitiesResponse.java | 1052 ++++ .../v1/AnalyzeEntitiesResponseOrBuilder.java | 77 + .../v1/AnalyzeEntitySentimentRequest.java | 789 +++ ...nalyzeEntitySentimentRequestOrBuilder.java | 55 + .../v1/AnalyzeEntitySentimentResponse.java | 1052 ++++ ...alyzeEntitySentimentResponseOrBuilder.java | 77 + .../language/v1/AnalyzeSentimentRequest.java | 789 +++ .../v1/AnalyzeSentimentRequestOrBuilder.java | 55 + .../language/v1/AnalyzeSentimentResponse.java | 1288 +++++ .../v1/AnalyzeSentimentResponseOrBuilder.java | 104 + .../language/v1/AnalyzeSyntaxRequest.java | 789 +++ .../v1/AnalyzeSyntaxRequestOrBuilder.java | 55 + .../language/v1/AnalyzeSyntaxResponse.java | 1492 ++++++ .../v1/AnalyzeSyntaxResponseOrBuilder.java | 121 + .../language/v1/AnnotateTextRequest.java | 2190 ++++++++ .../v1/AnnotateTextRequestOrBuilder.java | 82 + .../language/v1/AnnotateTextResponse.java | 2735 ++++++++++ .../v1/AnnotateTextResponseOrBuilder.java | 264 + .../language/v1/ClassificationCategory.java | 688 +++ .../v1/ClassificationCategoryOrBuilder.java | 42 + .../v1/ClassificationModelOptions.java | 2206 ++++++++ .../ClassificationModelOptionsOrBuilder.java | 74 + .../language/v1/ClassifyTextRequest.java | 913 ++++ .../v1/ClassifyTextRequestOrBuilder.java | 66 + .../language/v1/ClassifyTextResponse.java | 872 ++++ .../v1/ClassifyTextResponseOrBuilder.java | 53 + .../cloud/language/v1/DependencyEdge.java | 2158 ++++++++ .../language/v1/DependencyEdgeOrBuilder.java | 42 + .../google/cloud/language/v1/Document.java | 1457 ++++++ .../cloud/language/v1/DocumentOrBuilder.java | 136 + .../cloud/language/v1/EncodingType.java | 185 + .../com/google/cloud/language/v1/Entity.java | 2292 +++++++++ .../cloud/language/v1/EntityMention.java | 1208 +++++ .../language/v1/EntityMentionOrBuilder.java | 91 + .../cloud/language/v1/EntityOrBuilder.java | 218 + .../language/v1/LanguageServiceProto.java | 569 +++ .../cloud/language/v1/PartOfSpeech.java | 4451 +++++++++++++++++ .../language/v1/PartOfSpeechOrBuilder.java | 237 + .../google/cloud/language/v1/Sentence.java | 925 ++++ .../cloud/language/v1/SentenceOrBuilder.java | 69 + .../google/cloud/language/v1/Sentiment.java | 607 +++ .../cloud/language/v1/SentimentOrBuilder.java | 32 + .../google/cloud/language/v1/TextSpan.java | 679 +++ .../cloud/language/v1/TextSpanOrBuilder.java | 40 + .../com/google/cloud/language/v1/Token.java | 1303 +++++ .../cloud/language/v1/TokenOrBuilder.java | 110 + .../cloud/language/v1/language_service.proto | 1175 +++++ .../analyzeentities/AsyncAnalyzeEntities.java | 52 + .../analyzeentities/SyncAnalyzeEntities.java | 48 + .../SyncAnalyzeEntitiesDocument.java | 42 + ...ncAnalyzeEntitiesDocumentEncodingtype.java | 45 + .../AsyncAnalyzeEntitySentiment.java | 52 + .../SyncAnalyzeEntitySentiment.java | 49 + .../SyncAnalyzeEntitySentimentDocument.java | 43 + ...zeEntitySentimentDocumentEncodingtype.java | 45 + .../AsyncAnalyzeSentiment.java | 52 + .../SyncAnalyzeSentiment.java | 48 + .../SyncAnalyzeSentimentDocument.java | 42 + ...cAnalyzeSentimentDocumentEncodingtype.java | 45 + .../analyzesyntax/AsyncAnalyzeSyntax.java | 52 + .../analyzesyntax/SyncAnalyzeSyntax.java | 48 + .../SyncAnalyzeSyntaxDocument.java | 42 + ...SyncAnalyzeSyntaxDocumentEncodingtype.java | 44 + .../annotatetext/AsyncAnnotateText.java | 53 + .../annotatetext/SyncAnnotateText.java | 49 + ...xtDocumentAnnotatetextrequestfeatures.java | 44 + ...notatetextrequestfeaturesEncodingtype.java | 48 + .../classifytext/AsyncClassifyText.java | 52 + .../classifytext/SyncClassifyText.java | 48 + .../SyncClassifyTextDocument.java | 42 + .../SyncCreateSetCredentialsProvider.java | 45 + .../SyncCreateSetCredentialsProvider1.java | 44 + .../create/SyncCreateSetEndpoint.java | 42 + .../SyncAnalyzeSentiment.java | 46 + .../SyncAnalyzeSentiment.java | 46 + .../v1beta2/LanguageServiceClient.java | 916 ++++ .../v1beta2/LanguageServiceSettings.java | 263 + .../language/v1beta2/gapic_metadata.json | 36 + .../cloud/language/v1beta2/package-info.java | 44 + .../GrpcLanguageServiceCallableFactory.java | 115 + .../v1beta2/stub/GrpcLanguageServiceStub.java | 300 ++ ...ttpJsonLanguageServiceCallableFactory.java | 105 + .../stub/HttpJsonLanguageServiceStub.java | 468 ++ .../v1beta2/stub/LanguageServiceStub.java | 74 + .../stub/LanguageServiceStubSettings.java | 470 ++ .../LanguageServiceClientHttpJsonTest.java | 595 +++ .../v1beta2/LanguageServiceClientTest.java | 542 ++ .../language/v1beta2/MockLanguageService.java | 59 + .../v1beta2/MockLanguageServiceImpl.java | 187 + .../language/v1beta2/LanguageServiceGrpc.java | 762 +++ .../v1beta2/AnalyzeEntitiesRequest.java | 789 +++ .../AnalyzeEntitiesRequestOrBuilder.java | 55 + .../v1beta2/AnalyzeEntitiesResponse.java | 1052 ++++ .../AnalyzeEntitiesResponseOrBuilder.java | 77 + .../AnalyzeEntitySentimentRequest.java | 789 +++ ...nalyzeEntitySentimentRequestOrBuilder.java | 55 + .../AnalyzeEntitySentimentResponse.java | 1052 ++++ ...alyzeEntitySentimentResponseOrBuilder.java | 77 + .../v1beta2/AnalyzeSentimentRequest.java | 796 +++ .../AnalyzeSentimentRequestOrBuilder.java | 57 + .../v1beta2/AnalyzeSentimentResponse.java | 1288 +++++ .../AnalyzeSentimentResponseOrBuilder.java | 104 + .../v1beta2/AnalyzeSyntaxRequest.java | 789 +++ .../AnalyzeSyntaxRequestOrBuilder.java | 55 + .../v1beta2/AnalyzeSyntaxResponse.java | 1492 ++++++ .../AnalyzeSyntaxResponseOrBuilder.java | 121 + .../language/v1beta2/AnnotateTextRequest.java | 2207 ++++++++ .../v1beta2/AnnotateTextRequestOrBuilder.java | 82 + .../v1beta2/AnnotateTextResponse.java | 2735 ++++++++++ .../AnnotateTextResponseOrBuilder.java | 264 + .../v1beta2/ClassificationCategory.java | 688 +++ .../ClassificationCategoryOrBuilder.java | 42 + .../v1beta2/ClassificationModelOptions.java | 2206 ++++++++ .../ClassificationModelOptionsOrBuilder.java | 74 + .../language/v1beta2/ClassifyTextRequest.java | 913 ++++ .../v1beta2/ClassifyTextRequestOrBuilder.java | 66 + .../v1beta2/ClassifyTextResponse.java | 872 ++++ .../ClassifyTextResponseOrBuilder.java | 53 + .../language/v1beta2/DependencyEdge.java | 2154 ++++++++ .../v1beta2/DependencyEdgeOrBuilder.java | 42 + .../cloud/language/v1beta2/Document.java | 1915 +++++++ .../language/v1beta2/DocumentOrBuilder.java | 181 + .../cloud/language/v1beta2/EncodingType.java | 185 + .../google/cloud/language/v1beta2/Entity.java | 2292 +++++++++ .../cloud/language/v1beta2/EntityMention.java | 1208 +++++ .../v1beta2/EntityMentionOrBuilder.java | 91 + .../language/v1beta2/EntityOrBuilder.java | 218 + .../v1beta2/LanguageServiceProto.java | 584 +++ .../cloud/language/v1beta2/PartOfSpeech.java | 4447 ++++++++++++++++ .../v1beta2/PartOfSpeechOrBuilder.java | 237 + .../cloud/language/v1beta2/Sentence.java | 925 ++++ .../language/v1beta2/SentenceOrBuilder.java | 69 + .../cloud/language/v1beta2/Sentiment.java | 609 +++ .../language/v1beta2/SentimentOrBuilder.java | 32 + .../cloud/language/v1beta2/TextSpan.java | 679 +++ .../language/v1beta2/TextSpanOrBuilder.java | 40 + .../google/cloud/language/v1beta2/Token.java | 1303 +++++ .../language/v1beta2/TokenOrBuilder.java | 110 + .../language/v1beta2/language_service.proto | 1199 +++++ .../analyzeentities/AsyncAnalyzeEntities.java | 52 + .../analyzeentities/SyncAnalyzeEntities.java | 48 + .../SyncAnalyzeEntitiesDocument.java | 42 + ...ncAnalyzeEntitiesDocumentEncodingtype.java | 45 + .../AsyncAnalyzeEntitySentiment.java | 52 + .../SyncAnalyzeEntitySentiment.java | 49 + .../SyncAnalyzeEntitySentimentDocument.java | 43 + ...zeEntitySentimentDocumentEncodingtype.java | 45 + .../AsyncAnalyzeSentiment.java | 52 + .../SyncAnalyzeSentiment.java | 48 + .../SyncAnalyzeSentimentDocument.java | 42 + ...cAnalyzeSentimentDocumentEncodingtype.java | 45 + .../analyzesyntax/AsyncAnalyzeSyntax.java | 52 + .../analyzesyntax/SyncAnalyzeSyntax.java | 48 + .../SyncAnalyzeSyntaxDocument.java | 42 + ...SyncAnalyzeSyntaxDocumentEncodingtype.java | 44 + .../annotatetext/AsyncAnnotateText.java | 53 + .../annotatetext/SyncAnnotateText.java | 49 + ...xtDocumentAnnotatetextrequestfeatures.java | 44 + ...notatetextrequestfeaturesEncodingtype.java | 48 + .../classifytext/AsyncClassifyText.java | 52 + .../classifytext/SyncClassifyText.java | 48 + .../SyncClassifyTextDocument.java | 42 + .../SyncCreateSetCredentialsProvider.java | 45 + .../SyncCreateSetCredentialsProvider1.java | 44 + .../create/SyncCreateSetEndpoint.java | 42 + .../SyncAnalyzeSentiment.java | 46 + .../SyncAnalyzeSentiment.java | 46 + 184 files changed, 86653 insertions(+) create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/gapic_metadata.json create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceCallableFactory.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceStub.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientHttpJsonTest.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java create mode 100644 owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java create mode 100644 owl-bot-staging/java-language/v1/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptions.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptionsOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdgeOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/Document.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DocumentOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/EncodingType.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/Entity.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/EntityMention.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/EntityMentionOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/EntityOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceProto.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/PartOfSpeech.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/PartOfSpeechOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/Sentence.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/SentenceOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/Sentiment.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/SentimentOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/TextSpan.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/TextSpanOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/Token.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/TokenOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/proto/google/cloud/language/v1/language_service.proto create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentities/AsyncAnalyzeEntities.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentities/SyncAnalyzeEntities.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentities/SyncAnalyzeEntitiesDocument.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentities/SyncAnalyzeEntitiesDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentitysentiment/AsyncAnalyzeEntitySentiment.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentitysentiment/SyncAnalyzeEntitySentiment.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentitysentiment/SyncAnalyzeEntitySentimentDocument.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzeentitysentiment/SyncAnalyzeEntitySentimentDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesentiment/AsyncAnalyzeSentiment.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesentiment/SyncAnalyzeSentiment.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesentiment/SyncAnalyzeSentimentDocument.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesentiment/SyncAnalyzeSentimentDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesyntax/AsyncAnalyzeSyntax.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesyntax/SyncAnalyzeSyntax.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesyntax/SyncAnalyzeSyntaxDocument.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/analyzesyntax/SyncAnalyzeSyntaxDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/annotatetext/AsyncAnnotateText.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/annotatetext/SyncAnnotateText.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/annotatetext/SyncAnnotateTextDocumentAnnotatetextrequestfeatures.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/annotatetext/SyncAnnotateTextDocumentAnnotatetextrequestfeaturesEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/classifytext/AsyncClassifyText.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/classifytext/SyncClassifyText.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/classifytext/SyncClassifyTextDocument.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/languageservicesettings/analyzesentiment/SyncAnalyzeSentiment.java create mode 100644 owl-bot-staging/java-language/v1/samples/snippets/generated/com/google/cloud/language/v1/stub/languageservicestubsettings/analyzesentiment/SyncAnalyzeSentiment.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceClient.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceSettings.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/gapic_metadata.json create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/package-info.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceCallableFactory.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/GrpcLanguageServiceStub.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceCallableFactory.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/HttpJsonLanguageServiceStub.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStub.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/main/java/com/google/cloud/language/v1beta2/stub/LanguageServiceStubSettings.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientHttpJsonTest.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/LanguageServiceClientTest.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageService.java create mode 100644 owl-bot-staging/java-language/v1beta2/google-cloud-language/src/test/java/com/google/cloud/language/v1beta2/MockLanguageServiceImpl.java create mode 100644 owl-bot-staging/java-language/v1beta2/grpc-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceGrpc.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitiesRequest.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitiesRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitiesResponse.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitiesResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitySentimentRequest.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitySentimentRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitySentimentResponse.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeEntitySentimentResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSentimentRequest.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSentimentRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSentimentResponse.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSentimentResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSyntaxRequest.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSyntaxRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSyntaxResponse.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnalyzeSyntaxResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnnotateTextRequest.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnnotateTextRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnnotateTextResponse.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/AnnotateTextResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassificationCategory.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassificationCategoryOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassificationModelOptions.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassificationModelOptionsOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassifyTextRequest.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassifyTextRequestOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassifyTextResponse.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/ClassifyTextResponseOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/DependencyEdge.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/DependencyEdgeOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/Document.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/DocumentOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/EncodingType.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/Entity.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/EntityMention.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/EntityMentionOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/EntityOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/LanguageServiceProto.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/PartOfSpeech.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/PartOfSpeechOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/Sentence.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/SentenceOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/Sentiment.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/SentimentOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/TextSpan.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/TextSpanOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/Token.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/java/com/google/cloud/language/v1beta2/TokenOrBuilder.java create mode 100644 owl-bot-staging/java-language/v1beta2/proto-google-cloud-language-v1beta2/src/main/proto/google/cloud/language/v1beta2/language_service.proto create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentities/AsyncAnalyzeEntities.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentities/SyncAnalyzeEntities.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentities/SyncAnalyzeEntitiesDocument.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentities/SyncAnalyzeEntitiesDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentitysentiment/AsyncAnalyzeEntitySentiment.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentitysentiment/SyncAnalyzeEntitySentiment.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentitysentiment/SyncAnalyzeEntitySentimentDocument.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzeentitysentiment/SyncAnalyzeEntitySentimentDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesentiment/AsyncAnalyzeSentiment.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesentiment/SyncAnalyzeSentiment.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesentiment/SyncAnalyzeSentimentDocument.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesentiment/SyncAnalyzeSentimentDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesyntax/AsyncAnalyzeSyntax.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesyntax/SyncAnalyzeSyntax.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesyntax/SyncAnalyzeSyntaxDocument.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/analyzesyntax/SyncAnalyzeSyntaxDocumentEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/annotatetext/AsyncAnnotateText.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/annotatetext/SyncAnnotateText.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/annotatetext/SyncAnnotateTextDocumentAnnotatetextrequestfeatures.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/annotatetext/SyncAnnotateTextDocumentAnnotatetextrequestfeaturesEncodingtype.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/classifytext/AsyncClassifyText.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/classifytext/SyncClassifyText.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/classifytext/SyncClassifyTextDocument.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageserviceclient/create/SyncCreateSetEndpoint.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/languageservicesettings/analyzesentiment/SyncAnalyzeSentiment.java create mode 100644 owl-bot-staging/java-language/v1beta2/samples/snippets/generated/com/google/cloud/language/v1beta2/stub/languageservicestubsettings/analyzesentiment/SyncAnalyzeSentiment.java diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java new file mode 100644 index 000000000000..f5c952be6084 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java @@ -0,0 +1,913 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.language.v1.stub.LanguageServiceStub; +import com.google.cloud.language.v1.stub.LanguageServiceStubSettings; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Provides text analysis operations such as sentiment analysis and entity + * recognition. + * + *

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

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

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

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

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

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of LanguageServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

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

To customize the endpoint: + * + *

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

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

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

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class LanguageServiceClient implements BackgroundResource { + private final LanguageServiceSettings settings; + private final LanguageServiceStub stub; + + /** Constructs an instance of LanguageServiceClient with default settings. */ + public static final LanguageServiceClient create() throws IOException { + return create(LanguageServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of LanguageServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final LanguageServiceClient create(LanguageServiceSettings settings) + throws IOException { + return new LanguageServiceClient(settings); + } + + /** + * Constructs an instance of LanguageServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(LanguageServiceSettings). + */ + public static final LanguageServiceClient create(LanguageServiceStub stub) { + return new LanguageServiceClient(stub); + } + + /** + * Constructs an instance of LanguageServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected LanguageServiceClient(LanguageServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((LanguageServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected LanguageServiceClient(LanguageServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final LanguageServiceSettings getSettings() { + return settings; + } + + public LanguageServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Analyzes the sentiment of the provided text. + * + *

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
+   *   AnnotateTextRequest request =
+   *       AnnotateTextRequest.newBuilder()
+   *           .setDocument(Document.newBuilder().build())
+   *           .setFeatures(AnnotateTextRequest.Features.newBuilder().build())
+   *           .setEncodingType(EncodingType.forNumber(0))
+   *           .build();
+   *   ApiFuture future =
+   *       languageServiceClient.annotateTextCallable().futureCall(request);
+   *   // Do something.
+   *   AnnotateTextResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable annotateTextCallable() { + return stub.annotateTextCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java new file mode 100644 index 000000000000..4063f95daccd --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java @@ -0,0 +1,262 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.language.v1.stub.LanguageServiceStubSettings; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link LanguageServiceClient}. + * + *

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

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

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

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

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

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to analyzeSentiment. */ + public UnaryCallSettings.Builder + analyzeSentimentSettings() { + return getStubSettingsBuilder().analyzeSentimentSettings(); + } + + /** Returns the builder for the settings used for calls to analyzeEntities. */ + public UnaryCallSettings.Builder + analyzeEntitiesSettings() { + return getStubSettingsBuilder().analyzeEntitiesSettings(); + } + + /** Returns the builder for the settings used for calls to analyzeEntitySentiment. */ + public UnaryCallSettings.Builder + analyzeEntitySentimentSettings() { + return getStubSettingsBuilder().analyzeEntitySentimentSettings(); + } + + /** Returns the builder for the settings used for calls to analyzeSyntax. */ + public UnaryCallSettings.Builder + analyzeSyntaxSettings() { + return getStubSettingsBuilder().analyzeSyntaxSettings(); + } + + /** Returns the builder for the settings used for calls to classifyText. */ + public UnaryCallSettings.Builder + classifyTextSettings() { + return getStubSettingsBuilder().classifyTextSettings(); + } + + /** Returns the builder for the settings used for calls to annotateText. */ + public UnaryCallSettings.Builder + annotateTextSettings() { + return getStubSettingsBuilder().annotateTextSettings(); + } + + @Override + public LanguageServiceSettings build() throws IOException { + return new LanguageServiceSettings(this); + } + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/gapic_metadata.json b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/gapic_metadata.json new file mode 100644 index 000000000000..465035658f4e --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/gapic_metadata.json @@ -0,0 +1,36 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.cloud.language.v1", + "libraryPackage": "com.google.cloud.language.v1", + "services": { + "LanguageService": { + "clients": { + "grpc": { + "libraryClient": "LanguageServiceClient", + "rpcs": { + "AnalyzeEntities": { + "methods": ["analyzeEntities", "analyzeEntities", "analyzeEntities", "analyzeEntitiesCallable"] + }, + "AnalyzeEntitySentiment": { + "methods": ["analyzeEntitySentiment", "analyzeEntitySentiment", "analyzeEntitySentiment", "analyzeEntitySentimentCallable"] + }, + "AnalyzeSentiment": { + "methods": ["analyzeSentiment", "analyzeSentiment", "analyzeSentiment", "analyzeSentimentCallable"] + }, + "AnalyzeSyntax": { + "methods": ["analyzeSyntax", "analyzeSyntax", "analyzeSyntax", "analyzeSyntaxCallable"] + }, + "AnnotateText": { + "methods": ["annotateText", "annotateText", "annotateText", "annotateTextCallable"] + }, + "ClassifyText": { + "methods": ["classifyText", "classifyText", "classifyTextCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java new file mode 100644 index 000000000000..a3260a785b20 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/package-info.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to Cloud Natural Language API + * + *

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

======================= LanguageServiceClient ======================= + * + *

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

Sample for LanguageServiceClient: + * + *

{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
+ *   Document document = Document.newBuilder().build();
+ *   AnalyzeSentimentResponse response = languageServiceClient.analyzeSentiment(document);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.cloud.language.v1; + +import javax.annotation.Generated; diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java new file mode 100644 index 000000000000..8fcd7a3b45c2 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the LanguageService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcLanguageServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java new file mode 100644 index 000000000000..7283548c19e5 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/GrpcLanguageServiceStub.java @@ -0,0 +1,297 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.language.v1.AnalyzeEntitiesRequest; +import com.google.cloud.language.v1.AnalyzeEntitiesResponse; +import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; +import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; +import com.google.cloud.language.v1.AnalyzeSentimentRequest; +import com.google.cloud.language.v1.AnalyzeSentimentResponse; +import com.google.cloud.language.v1.AnalyzeSyntaxRequest; +import com.google.cloud.language.v1.AnalyzeSyntaxResponse; +import com.google.cloud.language.v1.AnnotateTextRequest; +import com.google.cloud.language.v1.AnnotateTextResponse; +import com.google.cloud.language.v1.ClassifyTextRequest; +import com.google.cloud.language.v1.ClassifyTextResponse; +import com.google.longrunning.stub.GrpcOperationsStub; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the LanguageService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcLanguageServiceStub extends LanguageServiceStub { + private static final MethodDescriptor + analyzeSentimentMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSentiment") + .setRequestMarshaller( + ProtoUtils.marshaller(AnalyzeSentimentRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(AnalyzeSentimentResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + analyzeEntitiesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntities") + .setRequestMarshaller( + ProtoUtils.marshaller(AnalyzeEntitiesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(AnalyzeEntitiesResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor< + AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> + analyzeEntitySentimentMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment") + .setRequestMarshaller( + ProtoUtils.marshaller(AnalyzeEntitySentimentRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(AnalyzeEntitySentimentResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + analyzeSyntaxMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSyntax") + .setRequestMarshaller( + ProtoUtils.marshaller(AnalyzeSyntaxRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(AnalyzeSyntaxResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + classifyTextMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.language.v1.LanguageService/ClassifyText") + .setRequestMarshaller(ProtoUtils.marshaller(ClassifyTextRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ClassifyTextResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + annotateTextMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.language.v1.LanguageService/AnnotateText") + .setRequestMarshaller(ProtoUtils.marshaller(AnnotateTextRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(AnnotateTextResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable + analyzeSentimentCallable; + private final UnaryCallable + analyzeEntitiesCallable; + private final UnaryCallable + analyzeEntitySentimentCallable; + private final UnaryCallable analyzeSyntaxCallable; + private final UnaryCallable classifyTextCallable; + private final UnaryCallable annotateTextCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcLanguageServiceStub create(LanguageServiceStubSettings settings) + throws IOException { + return new GrpcLanguageServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcLanguageServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcLanguageServiceStub( + LanguageServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcLanguageServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcLanguageServiceStub( + LanguageServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcLanguageServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcLanguageServiceStub( + LanguageServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcLanguageServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcLanguageServiceStub, using the given settings. This is protected + * so that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcLanguageServiceStub( + LanguageServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings + analyzeSentimentTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(analyzeSentimentMethodDescriptor) + .build(); + GrpcCallSettings + analyzeEntitiesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(analyzeEntitiesMethodDescriptor) + .build(); + GrpcCallSettings + analyzeEntitySentimentTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(analyzeEntitySentimentMethodDescriptor) + .build(); + GrpcCallSettings analyzeSyntaxTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(analyzeSyntaxMethodDescriptor) + .build(); + GrpcCallSettings classifyTextTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(classifyTextMethodDescriptor) + .build(); + GrpcCallSettings annotateTextTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(annotateTextMethodDescriptor) + .build(); + + this.analyzeSentimentCallable = + callableFactory.createUnaryCallable( + analyzeSentimentTransportSettings, settings.analyzeSentimentSettings(), clientContext); + this.analyzeEntitiesCallable = + callableFactory.createUnaryCallable( + analyzeEntitiesTransportSettings, settings.analyzeEntitiesSettings(), clientContext); + this.analyzeEntitySentimentCallable = + callableFactory.createUnaryCallable( + analyzeEntitySentimentTransportSettings, + settings.analyzeEntitySentimentSettings(), + clientContext); + this.analyzeSyntaxCallable = + callableFactory.createUnaryCallable( + analyzeSyntaxTransportSettings, settings.analyzeSyntaxSettings(), clientContext); + this.classifyTextCallable = + callableFactory.createUnaryCallable( + classifyTextTransportSettings, settings.classifyTextSettings(), clientContext); + this.annotateTextCallable = + callableFactory.createUnaryCallable( + annotateTextTransportSettings, settings.annotateTextSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable + analyzeSentimentCallable() { + return analyzeSentimentCallable; + } + + @Override + public UnaryCallable analyzeEntitiesCallable() { + return analyzeEntitiesCallable; + } + + @Override + public UnaryCallable + analyzeEntitySentimentCallable() { + return analyzeEntitySentimentCallable; + } + + @Override + public UnaryCallable analyzeSyntaxCallable() { + return analyzeSyntaxCallable; + } + + @Override + public UnaryCallable classifyTextCallable() { + return classifyTextCallable; + } + + @Override + public UnaryCallable annotateTextCallable() { + return annotateTextCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceCallableFactory.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceCallableFactory.java new file mode 100644 index 000000000000..e6957779c3e9 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the LanguageService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonLanguageServiceCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceStub.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceStub.java new file mode 100644 index 000000000000..7956fe995113 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/HttpJsonLanguageServiceStub.java @@ -0,0 +1,467 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.language.v1.AnalyzeEntitiesRequest; +import com.google.cloud.language.v1.AnalyzeEntitiesResponse; +import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; +import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; +import com.google.cloud.language.v1.AnalyzeSentimentRequest; +import com.google.cloud.language.v1.AnalyzeSentimentResponse; +import com.google.cloud.language.v1.AnalyzeSyntaxRequest; +import com.google.cloud.language.v1.AnalyzeSyntaxResponse; +import com.google.cloud.language.v1.AnnotateTextRequest; +import com.google.cloud.language.v1.AnnotateTextResponse; +import com.google.cloud.language.v1.ClassifyTextRequest; +import com.google.cloud.language.v1.ClassifyTextResponse; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the LanguageService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonLanguageServiceStub extends LanguageServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + analyzeSentimentMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSentiment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/documents:analyzeSentiment", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AnalyzeSentimentResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + analyzeEntitiesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntities") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/documents:analyzeEntities", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AnalyzeEntitiesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + AnalyzeEntitySentimentRequest, AnalyzeEntitySentimentResponse> + analyzeEntitySentimentMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeEntitySentiment") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/documents:analyzeEntitySentiment", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AnalyzeEntitySentimentResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + analyzeSyntaxMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.language.v1.LanguageService/AnalyzeSyntax") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/documents:analyzeSyntax", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AnalyzeSyntaxResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + classifyTextMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.language.v1.LanguageService/ClassifyText") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/documents:classifyText", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ClassifyTextResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + annotateTextMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.language.v1.LanguageService/AnnotateText") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/documents:annotateText", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().build(), false)) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AnnotateTextResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable + analyzeSentimentCallable; + private final UnaryCallable + analyzeEntitiesCallable; + private final UnaryCallable + analyzeEntitySentimentCallable; + private final UnaryCallable analyzeSyntaxCallable; + private final UnaryCallable classifyTextCallable; + private final UnaryCallable annotateTextCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonLanguageServiceStub create(LanguageServiceStubSettings settings) + throws IOException { + return new HttpJsonLanguageServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonLanguageServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonLanguageServiceStub( + LanguageServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonLanguageServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonLanguageServiceStub( + LanguageServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonLanguageServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonLanguageServiceStub( + LanguageServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonLanguageServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonLanguageServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonLanguageServiceStub( + LanguageServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + analyzeSentimentTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(analyzeSentimentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + analyzeEntitiesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(analyzeEntitiesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + analyzeEntitySentimentTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(analyzeEntitySentimentMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + analyzeSyntaxTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(analyzeSyntaxMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings classifyTextTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(classifyTextMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings annotateTextTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(annotateTextMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.analyzeSentimentCallable = + callableFactory.createUnaryCallable( + analyzeSentimentTransportSettings, settings.analyzeSentimentSettings(), clientContext); + this.analyzeEntitiesCallable = + callableFactory.createUnaryCallable( + analyzeEntitiesTransportSettings, settings.analyzeEntitiesSettings(), clientContext); + this.analyzeEntitySentimentCallable = + callableFactory.createUnaryCallable( + analyzeEntitySentimentTransportSettings, + settings.analyzeEntitySentimentSettings(), + clientContext); + this.analyzeSyntaxCallable = + callableFactory.createUnaryCallable( + analyzeSyntaxTransportSettings, settings.analyzeSyntaxSettings(), clientContext); + this.classifyTextCallable = + callableFactory.createUnaryCallable( + classifyTextTransportSettings, settings.classifyTextSettings(), clientContext); + this.annotateTextCallable = + callableFactory.createUnaryCallable( + annotateTextTransportSettings, settings.annotateTextSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(analyzeSentimentMethodDescriptor); + methodDescriptors.add(analyzeEntitiesMethodDescriptor); + methodDescriptors.add(analyzeEntitySentimentMethodDescriptor); + methodDescriptors.add(analyzeSyntaxMethodDescriptor); + methodDescriptors.add(classifyTextMethodDescriptor); + methodDescriptors.add(annotateTextMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable + analyzeSentimentCallable() { + return analyzeSentimentCallable; + } + + @Override + public UnaryCallable analyzeEntitiesCallable() { + return analyzeEntitiesCallable; + } + + @Override + public UnaryCallable + analyzeEntitySentimentCallable() { + return analyzeEntitySentimentCallable; + } + + @Override + public UnaryCallable analyzeSyntaxCallable() { + return analyzeSyntaxCallable; + } + + @Override + public UnaryCallable classifyTextCallable() { + return classifyTextCallable; + } + + @Override + public UnaryCallable annotateTextCallable() { + return annotateTextCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java new file mode 100644 index 000000000000..89ea00362502 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStub.java @@ -0,0 +1,72 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1.stub; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.language.v1.AnalyzeEntitiesRequest; +import com.google.cloud.language.v1.AnalyzeEntitiesResponse; +import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; +import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; +import com.google.cloud.language.v1.AnalyzeSentimentRequest; +import com.google.cloud.language.v1.AnalyzeSentimentResponse; +import com.google.cloud.language.v1.AnalyzeSyntaxRequest; +import com.google.cloud.language.v1.AnalyzeSyntaxResponse; +import com.google.cloud.language.v1.AnnotateTextRequest; +import com.google.cloud.language.v1.AnnotateTextResponse; +import com.google.cloud.language.v1.ClassifyTextRequest; +import com.google.cloud.language.v1.ClassifyTextResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the LanguageService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class LanguageServiceStub implements BackgroundResource { + + public UnaryCallable + analyzeSentimentCallable() { + throw new UnsupportedOperationException("Not implemented: analyzeSentimentCallable()"); + } + + public UnaryCallable analyzeEntitiesCallable() { + throw new UnsupportedOperationException("Not implemented: analyzeEntitiesCallable()"); + } + + public UnaryCallable + analyzeEntitySentimentCallable() { + throw new UnsupportedOperationException("Not implemented: analyzeEntitySentimentCallable()"); + } + + public UnaryCallable analyzeSyntaxCallable() { + throw new UnsupportedOperationException("Not implemented: analyzeSyntaxCallable()"); + } + + public UnaryCallable classifyTextCallable() { + throw new UnsupportedOperationException("Not implemented: classifyTextCallable()"); + } + + public UnaryCallable annotateTextCallable() { + throw new UnsupportedOperationException("Not implemented: annotateTextCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java new file mode 100644 index 000000000000..2b66259234dd --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/main/java/com/google/cloud/language/v1/stub/LanguageServiceStubSettings.java @@ -0,0 +1,469 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1.stub; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.language.v1.AnalyzeEntitiesRequest; +import com.google.cloud.language.v1.AnalyzeEntitiesResponse; +import com.google.cloud.language.v1.AnalyzeEntitySentimentRequest; +import com.google.cloud.language.v1.AnalyzeEntitySentimentResponse; +import com.google.cloud.language.v1.AnalyzeSentimentRequest; +import com.google.cloud.language.v1.AnalyzeSentimentResponse; +import com.google.cloud.language.v1.AnalyzeSyntaxRequest; +import com.google.cloud.language.v1.AnalyzeSyntaxResponse; +import com.google.cloud.language.v1.AnnotateTextRequest; +import com.google.cloud.language.v1.AnnotateTextResponse; +import com.google.cloud.language.v1.ClassifyTextRequest; +import com.google.cloud.language.v1.ClassifyTextResponse; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link LanguageServiceStub}. + * + *

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

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

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

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

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

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to analyzeSentiment. */ + public UnaryCallSettings.Builder + analyzeSentimentSettings() { + return analyzeSentimentSettings; + } + + /** Returns the builder for the settings used for calls to analyzeEntities. */ + public UnaryCallSettings.Builder + analyzeEntitiesSettings() { + return analyzeEntitiesSettings; + } + + /** Returns the builder for the settings used for calls to analyzeEntitySentiment. */ + public UnaryCallSettings.Builder + analyzeEntitySentimentSettings() { + return analyzeEntitySentimentSettings; + } + + /** Returns the builder for the settings used for calls to analyzeSyntax. */ + public UnaryCallSettings.Builder + analyzeSyntaxSettings() { + return analyzeSyntaxSettings; + } + + /** Returns the builder for the settings used for calls to classifyText. */ + public UnaryCallSettings.Builder + classifyTextSettings() { + return classifyTextSettings; + } + + /** Returns the builder for the settings used for calls to annotateText. */ + public UnaryCallSettings.Builder + annotateTextSettings() { + return annotateTextSettings; + } + + @Override + public LanguageServiceStubSettings build() throws IOException { + return new LanguageServiceStubSettings(this); + } + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientHttpJsonTest.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientHttpJsonTest.java new file mode 100644 index 000000000000..826e982e6169 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientHttpJsonTest.java @@ -0,0 +1,595 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.language.v1.stub.HttpJsonLanguageServiceStub; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class LanguageServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static LanguageServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonLanguageServiceStub.getMethodDescriptors(), + LanguageServiceSettings.getDefaultEndpoint()); + LanguageServiceSettings settings = + LanguageServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + LanguageServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = LanguageServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void analyzeSentimentTest() throws Exception { + AnalyzeSentimentResponse expectedResponse = + AnalyzeSentimentResponse.newBuilder() + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllSentences(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeSentimentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeSentiment(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeSentimentTest2() throws Exception { + AnalyzeSentimentResponse expectedResponse = + AnalyzeSentimentResponse.newBuilder() + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllSentences(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeSentimentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeSentiment(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitiesTest() throws Exception { + AnalyzeEntitiesResponse expectedResponse = + AnalyzeEntitiesResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeEntitiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeEntities(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitiesTest2() throws Exception { + AnalyzeEntitiesResponse expectedResponse = + AnalyzeEntitiesResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeEntitiesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeEntities(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitySentimentTest() throws Exception { + AnalyzeEntitySentimentResponse expectedResponse = + AnalyzeEntitySentimentResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeEntitySentimentExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeEntitySentiment(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitySentimentTest2() throws Exception { + AnalyzeEntitySentimentResponse expectedResponse = + AnalyzeEntitySentimentResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeEntitySentimentResponse actualResponse = + client.analyzeEntitySentiment(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeEntitySentimentExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeEntitySentiment(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeSyntaxTest() throws Exception { + AnalyzeSyntaxResponse expectedResponse = + AnalyzeSyntaxResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeSyntaxExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeSyntax(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeSyntaxTest2() throws Exception { + AnalyzeSyntaxResponse expectedResponse = + AnalyzeSyntaxResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void analyzeSyntaxExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeSyntax(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void classifyTextTest() throws Exception { + ClassifyTextResponse expectedResponse = + ClassifyTextResponse.newBuilder() + .addAllCategories(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + ClassifyTextResponse actualResponse = client.classifyText(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void classifyTextExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.classifyText(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void annotateTextTest() throws Exception { + AnnotateTextResponse expectedResponse = + AnnotateTextResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .addAllEntities(new ArrayList()) + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllCategories(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + + AnnotateTextResponse actualResponse = client.annotateText(document, features); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void annotateTextExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + client.annotateText(document, features); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void annotateTextTest2() throws Exception { + AnnotateTextResponse expectedResponse = + AnnotateTextResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .addAllEntities(new ArrayList()) + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllCategories(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnnotateTextResponse actualResponse = client.annotateText(document, features, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void annotateTextExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.annotateText(document, features, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java new file mode 100644 index 000000000000..a896aa72c6bc --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/LanguageServiceClientTest.java @@ -0,0 +1,542 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.protobuf.AbstractMessage; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class LanguageServiceClientTest { + private static MockLanguageService mockLanguageService; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private LanguageServiceClient client; + + @BeforeClass + public static void startStaticServer() { + mockLanguageService = new MockLanguageService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockLanguageService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + LanguageServiceSettings settings = + LanguageServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = LanguageServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void analyzeSentimentTest() throws Exception { + AnalyzeSentimentResponse expectedResponse = + AnalyzeSentimentResponse.newBuilder() + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllSentences(new ArrayList()) + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeSentimentRequest actualRequest = ((AnalyzeSentimentRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeSentimentExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeSentiment(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeSentimentTest2() throws Exception { + AnalyzeSentimentResponse expectedResponse = + AnalyzeSentimentResponse.newBuilder() + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllSentences(new ArrayList()) + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeSentimentRequest actualRequest = ((AnalyzeSentimentRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertEquals(encodingType, actualRequest.getEncodingType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeSentimentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeSentiment(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitiesTest() throws Exception { + AnalyzeEntitiesResponse expectedResponse = + AnalyzeEntitiesResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeEntitiesRequest actualRequest = ((AnalyzeEntitiesRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeEntitiesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeEntities(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitiesTest2() throws Exception { + AnalyzeEntitiesResponse expectedResponse = + AnalyzeEntitiesResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeEntitiesResponse actualResponse = client.analyzeEntities(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeEntitiesRequest actualRequest = ((AnalyzeEntitiesRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertEquals(encodingType, actualRequest.getEncodingType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeEntitiesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeEntities(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitySentimentTest() throws Exception { + AnalyzeEntitySentimentResponse expectedResponse = + AnalyzeEntitySentimentResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeEntitySentimentRequest actualRequest = + ((AnalyzeEntitySentimentRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeEntitySentimentExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeEntitySentiment(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeEntitySentimentTest2() throws Exception { + AnalyzeEntitySentimentResponse expectedResponse = + AnalyzeEntitySentimentResponse.newBuilder() + .addAllEntities(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeEntitySentimentResponse actualResponse = + client.analyzeEntitySentiment(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeEntitySentimentRequest actualRequest = + ((AnalyzeEntitySentimentRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertEquals(encodingType, actualRequest.getEncodingType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeEntitySentimentExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeEntitySentiment(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeSyntaxTest() throws Exception { + AnalyzeSyntaxResponse expectedResponse = + AnalyzeSyntaxResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeSyntaxRequest actualRequest = ((AnalyzeSyntaxRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeSyntaxExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.analyzeSyntax(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void analyzeSyntaxTest2() throws Exception { + AnalyzeSyntaxResponse expectedResponse = + AnalyzeSyntaxResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .setLanguage("language-1613589672") + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnalyzeSyntaxRequest actualRequest = ((AnalyzeSyntaxRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertEquals(encodingType, actualRequest.getEncodingType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void analyzeSyntaxExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.analyzeSyntax(document, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void classifyTextTest() throws Exception { + ClassifyTextResponse expectedResponse = + ClassifyTextResponse.newBuilder() + .addAllCategories(new ArrayList()) + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + + ClassifyTextResponse actualResponse = client.classifyText(document); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ClassifyTextRequest actualRequest = ((ClassifyTextRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void classifyTextExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + client.classifyText(document); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void annotateTextTest() throws Exception { + AnnotateTextResponse expectedResponse = + AnnotateTextResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .addAllEntities(new ArrayList()) + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllCategories(new ArrayList()) + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + + AnnotateTextResponse actualResponse = client.annotateText(document, features); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnnotateTextRequest actualRequest = ((AnnotateTextRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertEquals(features, actualRequest.getFeatures()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void annotateTextExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + client.annotateText(document, features); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void annotateTextTest2() throws Exception { + AnnotateTextResponse expectedResponse = + AnnotateTextResponse.newBuilder() + .addAllSentences(new ArrayList()) + .addAllTokens(new ArrayList()) + .addAllEntities(new ArrayList()) + .setDocumentSentiment(Sentiment.newBuilder().build()) + .setLanguage("language-1613589672") + .addAllCategories(new ArrayList()) + .build(); + mockLanguageService.addResponse(expectedResponse); + + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + + AnnotateTextResponse actualResponse = client.annotateText(document, features, encodingType); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockLanguageService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + AnnotateTextRequest actualRequest = ((AnnotateTextRequest) actualRequests.get(0)); + + Assert.assertEquals(document, actualRequest.getDocument()); + Assert.assertEquals(features, actualRequest.getFeatures()); + Assert.assertEquals(encodingType, actualRequest.getEncodingType()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void annotateTextExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockLanguageService.addException(exception); + + try { + Document document = Document.newBuilder().build(); + AnnotateTextRequest.Features features = AnnotateTextRequest.Features.newBuilder().build(); + EncodingType encodingType = EncodingType.forNumber(0); + client.annotateText(document, features, encodingType); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java new file mode 100644 index 000000000000..ce5bbe58f03a --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLanguageService implements MockGrpcService { + private final MockLanguageServiceImpl serviceImpl; + + public MockLanguageService() { + serviceImpl = new MockLanguageServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java new file mode 100644 index 000000000000..a7eddf3e45d5 --- /dev/null +++ b/owl-bot-staging/java-language/v1/google-cloud-language/src/test/java/com/google/cloud/language/v1/MockLanguageServiceImpl.java @@ -0,0 +1,187 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.language.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.language.v1.LanguageServiceGrpc.LanguageServiceImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockLanguageServiceImpl extends LanguageServiceImplBase { + private List requests; + private Queue responses; + + public MockLanguageServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void analyzeSentiment( + AnalyzeSentimentRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AnalyzeSentimentResponse) { + requests.add(request); + responseObserver.onNext(((AnalyzeSentimentResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method AnalyzeSentiment, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AnalyzeSentimentResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void analyzeEntities( + AnalyzeEntitiesRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AnalyzeEntitiesResponse) { + requests.add(request); + responseObserver.onNext(((AnalyzeEntitiesResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method AnalyzeEntities, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AnalyzeEntitiesResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void analyzeEntitySentiment( + AnalyzeEntitySentimentRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AnalyzeEntitySentimentResponse) { + requests.add(request); + responseObserver.onNext(((AnalyzeEntitySentimentResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method AnalyzeEntitySentiment, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AnalyzeEntitySentimentResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void analyzeSyntax( + AnalyzeSyntaxRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AnalyzeSyntaxResponse) { + requests.add(request); + responseObserver.onNext(((AnalyzeSyntaxResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method AnalyzeSyntax, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AnalyzeSyntaxResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void classifyText( + ClassifyTextRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ClassifyTextResponse) { + requests.add(request); + responseObserver.onNext(((ClassifyTextResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ClassifyText, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ClassifyTextResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void annotateText( + AnnotateTextRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof AnnotateTextResponse) { + requests.add(request); + responseObserver.onNext(((AnnotateTextResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method AnnotateText, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + AnnotateTextResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/owl-bot-staging/java-language/v1/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java b/owl-bot-staging/java-language/v1/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java new file mode 100644 index 000000000000..a287faa14b79 --- /dev/null +++ b/owl-bot-staging/java-language/v1/grpc-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/LanguageServiceGrpc.java @@ -0,0 +1,762 @@ +package com.google.cloud.language.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + *
+ * Provides text analysis operations such as sentiment analysis and entity
+ * recognition.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/language/v1/language_service.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class LanguageServiceGrpc { + + private LanguageServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.language.v1.LanguageService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getAnalyzeSentimentMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "AnalyzeSentiment", + requestType = com.google.cloud.language.v1.AnalyzeSentimentRequest.class, + responseType = com.google.cloud.language.v1.AnalyzeSentimentResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getAnalyzeSentimentMethod() { + io.grpc.MethodDescriptor getAnalyzeSentimentMethod; + if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) { + synchronized (LanguageServiceGrpc.class) { + if ((getAnalyzeSentimentMethod = LanguageServiceGrpc.getAnalyzeSentimentMethod) == null) { + LanguageServiceGrpc.getAnalyzeSentimentMethod = getAnalyzeSentimentMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSentiment")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeSentimentRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeSentimentResponse.getDefaultInstance())) + .setSchemaDescriptor(new LanguageServiceMethodDescriptorSupplier("AnalyzeSentiment")) + .build(); + } + } + } + return getAnalyzeSentimentMethod; + } + + private static volatile io.grpc.MethodDescriptor getAnalyzeEntitiesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntities", + requestType = com.google.cloud.language.v1.AnalyzeEntitiesRequest.class, + responseType = com.google.cloud.language.v1.AnalyzeEntitiesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getAnalyzeEntitiesMethod() { + io.grpc.MethodDescriptor getAnalyzeEntitiesMethod; + if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) { + synchronized (LanguageServiceGrpc.class) { + if ((getAnalyzeEntitiesMethod = LanguageServiceGrpc.getAnalyzeEntitiesMethod) == null) { + LanguageServiceGrpc.getAnalyzeEntitiesMethod = getAnalyzeEntitiesMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeEntities")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeEntitiesRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeEntitiesResponse.getDefaultInstance())) + .setSchemaDescriptor(new LanguageServiceMethodDescriptorSupplier("AnalyzeEntities")) + .build(); + } + } + } + return getAnalyzeEntitiesMethod; + } + + private static volatile io.grpc.MethodDescriptor getAnalyzeEntitySentimentMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "AnalyzeEntitySentiment", + requestType = com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.class, + responseType = com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getAnalyzeEntitySentimentMethod() { + io.grpc.MethodDescriptor getAnalyzeEntitySentimentMethod; + if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod) == null) { + synchronized (LanguageServiceGrpc.class) { + if ((getAnalyzeEntitySentimentMethod = LanguageServiceGrpc.getAnalyzeEntitySentimentMethod) == null) { + LanguageServiceGrpc.getAnalyzeEntitySentimentMethod = getAnalyzeEntitySentimentMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeEntitySentiment")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeEntitySentimentRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.getDefaultInstance())) + .setSchemaDescriptor(new LanguageServiceMethodDescriptorSupplier("AnalyzeEntitySentiment")) + .build(); + } + } + } + return getAnalyzeEntitySentimentMethod; + } + + private static volatile io.grpc.MethodDescriptor getAnalyzeSyntaxMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "AnalyzeSyntax", + requestType = com.google.cloud.language.v1.AnalyzeSyntaxRequest.class, + responseType = com.google.cloud.language.v1.AnalyzeSyntaxResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getAnalyzeSyntaxMethod() { + io.grpc.MethodDescriptor getAnalyzeSyntaxMethod; + if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) { + synchronized (LanguageServiceGrpc.class) { + if ((getAnalyzeSyntaxMethod = LanguageServiceGrpc.getAnalyzeSyntaxMethod) == null) { + LanguageServiceGrpc.getAnalyzeSyntaxMethod = getAnalyzeSyntaxMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnalyzeSyntax")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeSyntaxRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnalyzeSyntaxResponse.getDefaultInstance())) + .setSchemaDescriptor(new LanguageServiceMethodDescriptorSupplier("AnalyzeSyntax")) + .build(); + } + } + } + return getAnalyzeSyntaxMethod; + } + + private static volatile io.grpc.MethodDescriptor getClassifyTextMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ClassifyText", + requestType = com.google.cloud.language.v1.ClassifyTextRequest.class, + responseType = com.google.cloud.language.v1.ClassifyTextResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getClassifyTextMethod() { + io.grpc.MethodDescriptor getClassifyTextMethod; + if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) { + synchronized (LanguageServiceGrpc.class) { + if ((getClassifyTextMethod = LanguageServiceGrpc.getClassifyTextMethod) == null) { + LanguageServiceGrpc.getClassifyTextMethod = getClassifyTextMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ClassifyText")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.ClassifyTextRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.ClassifyTextResponse.getDefaultInstance())) + .setSchemaDescriptor(new LanguageServiceMethodDescriptorSupplier("ClassifyText")) + .build(); + } + } + } + return getClassifyTextMethod; + } + + private static volatile io.grpc.MethodDescriptor getAnnotateTextMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "AnnotateText", + requestType = com.google.cloud.language.v1.AnnotateTextRequest.class, + responseType = com.google.cloud.language.v1.AnnotateTextResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getAnnotateTextMethod() { + io.grpc.MethodDescriptor getAnnotateTextMethod; + if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) { + synchronized (LanguageServiceGrpc.class) { + if ((getAnnotateTextMethod = LanguageServiceGrpc.getAnnotateTextMethod) == null) { + LanguageServiceGrpc.getAnnotateTextMethod = getAnnotateTextMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "AnnotateText")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnnotateTextRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.language.v1.AnnotateTextResponse.getDefaultInstance())) + .setSchemaDescriptor(new LanguageServiceMethodDescriptorSupplier("AnnotateText")) + .build(); + } + } + } + return getAnnotateTextMethod; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static LanguageServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public LanguageServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LanguageServiceStub(channel, callOptions); + } + }; + return LanguageServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static LanguageServiceBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public LanguageServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LanguageServiceBlockingStub(channel, callOptions); + } + }; + return LanguageServiceBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static LanguageServiceFutureStub newFutureStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public LanguageServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LanguageServiceFutureStub(channel, callOptions); + } + }; + return LanguageServiceFutureStub.newStub(factory, channel); + } + + /** + *
+   * Provides text analysis operations such as sentiment analysis and entity
+   * recognition.
+   * 
+ */ + public static abstract class LanguageServiceImplBase implements io.grpc.BindableService { + + /** + *
+     * Analyzes the sentiment of the provided text.
+     * 
+ */ + public void analyzeSentiment(com.google.cloud.language.v1.AnalyzeSentimentRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getAnalyzeSentimentMethod(), responseObserver); + } + + /** + *
+     * Finds named entities (currently proper names and common nouns) in the text
+     * along with entity types, salience, mentions for each entity, and
+     * other properties.
+     * 
+ */ + public void analyzeEntities(com.google.cloud.language.v1.AnalyzeEntitiesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getAnalyzeEntitiesMethod(), responseObserver); + } + + /** + *
+     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
+     * sentiment associated with each entity and its mentions.
+     * 
+ */ + public void analyzeEntitySentiment(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getAnalyzeEntitySentimentMethod(), responseObserver); + } + + /** + *
+     * Analyzes the syntax of the text and provides sentence boundaries and
+     * tokenization along with part of speech tags, dependency trees, and other
+     * properties.
+     * 
+ */ + public void analyzeSyntax(com.google.cloud.language.v1.AnalyzeSyntaxRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getAnalyzeSyntaxMethod(), responseObserver); + } + + /** + *
+     * Classifies a document into categories.
+     * 
+ */ + public void classifyText(com.google.cloud.language.v1.ClassifyTextRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getClassifyTextMethod(), responseObserver); + } + + /** + *
+     * A convenience method that provides all the features that analyzeSentiment,
+     * analyzeEntities, and analyzeSyntax provide in one call.
+     * 
+ */ + public void annotateText(com.google.cloud.language.v1.AnnotateTextRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getAnnotateTextMethod(), responseObserver); + } + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getAnalyzeSentimentMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.language.v1.AnalyzeSentimentRequest, + com.google.cloud.language.v1.AnalyzeSentimentResponse>( + this, METHODID_ANALYZE_SENTIMENT))) + .addMethod( + getAnalyzeEntitiesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.language.v1.AnalyzeEntitiesRequest, + com.google.cloud.language.v1.AnalyzeEntitiesResponse>( + this, METHODID_ANALYZE_ENTITIES))) + .addMethod( + getAnalyzeEntitySentimentMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.language.v1.AnalyzeEntitySentimentRequest, + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse>( + this, METHODID_ANALYZE_ENTITY_SENTIMENT))) + .addMethod( + getAnalyzeSyntaxMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.language.v1.AnalyzeSyntaxRequest, + com.google.cloud.language.v1.AnalyzeSyntaxResponse>( + this, METHODID_ANALYZE_SYNTAX))) + .addMethod( + getClassifyTextMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.language.v1.ClassifyTextRequest, + com.google.cloud.language.v1.ClassifyTextResponse>( + this, METHODID_CLASSIFY_TEXT))) + .addMethod( + getAnnotateTextMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.language.v1.AnnotateTextRequest, + com.google.cloud.language.v1.AnnotateTextResponse>( + this, METHODID_ANNOTATE_TEXT))) + .build(); + } + } + + /** + *
+   * Provides text analysis operations such as sentiment analysis and entity
+   * recognition.
+   * 
+ */ + public static final class LanguageServiceStub extends io.grpc.stub.AbstractAsyncStub { + private LanguageServiceStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected LanguageServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LanguageServiceStub(channel, callOptions); + } + + /** + *
+     * Analyzes the sentiment of the provided text.
+     * 
+ */ + public void analyzeSentiment(com.google.cloud.language.v1.AnalyzeSentimentRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Finds named entities (currently proper names and common nouns) in the text
+     * along with entity types, salience, mentions for each entity, and
+     * other properties.
+     * 
+ */ + public void analyzeEntities(com.google.cloud.language.v1.AnalyzeEntitiesRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
+     * sentiment associated with each entity and its mentions.
+     * 
+ */ + public void analyzeEntitySentiment(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Analyzes the syntax of the text and provides sentence boundaries and
+     * tokenization along with part of speech tags, dependency trees, and other
+     * properties.
+     * 
+ */ + public void analyzeSyntax(com.google.cloud.language.v1.AnalyzeSyntaxRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Classifies a document into categories.
+     * 
+ */ + public void classifyText(com.google.cloud.language.v1.ClassifyTextRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getClassifyTextMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * A convenience method that provides all the features that analyzeSentiment,
+     * analyzeEntities, and analyzeSyntax provide in one call.
+     * 
+ */ + public void annotateText(com.google.cloud.language.v1.AnnotateTextRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getAnnotateTextMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + *
+   * Provides text analysis operations such as sentiment analysis and entity
+   * recognition.
+   * 
+ */ + public static final class LanguageServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub { + private LanguageServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected LanguageServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LanguageServiceBlockingStub(channel, callOptions); + } + + /** + *
+     * Analyzes the sentiment of the provided text.
+     * 
+ */ + public com.google.cloud.language.v1.AnalyzeSentimentResponse analyzeSentiment(com.google.cloud.language.v1.AnalyzeSentimentRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAnalyzeSentimentMethod(), getCallOptions(), request); + } + + /** + *
+     * Finds named entities (currently proper names and common nouns) in the text
+     * along with entity types, salience, mentions for each entity, and
+     * other properties.
+     * 
+ */ + public com.google.cloud.language.v1.AnalyzeEntitiesResponse analyzeEntities(com.google.cloud.language.v1.AnalyzeEntitiesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAnalyzeEntitiesMethod(), getCallOptions(), request); + } + + /** + *
+     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
+     * sentiment associated with each entity and its mentions.
+     * 
+ */ + public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse analyzeEntitySentiment(com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAnalyzeEntitySentimentMethod(), getCallOptions(), request); + } + + /** + *
+     * Analyzes the syntax of the text and provides sentence boundaries and
+     * tokenization along with part of speech tags, dependency trees, and other
+     * properties.
+     * 
+ */ + public com.google.cloud.language.v1.AnalyzeSyntaxResponse analyzeSyntax(com.google.cloud.language.v1.AnalyzeSyntaxRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAnalyzeSyntaxMethod(), getCallOptions(), request); + } + + /** + *
+     * Classifies a document into categories.
+     * 
+ */ + public com.google.cloud.language.v1.ClassifyTextResponse classifyText(com.google.cloud.language.v1.ClassifyTextRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getClassifyTextMethod(), getCallOptions(), request); + } + + /** + *
+     * A convenience method that provides all the features that analyzeSentiment,
+     * analyzeEntities, and analyzeSyntax provide in one call.
+     * 
+ */ + public com.google.cloud.language.v1.AnnotateTextResponse annotateText(com.google.cloud.language.v1.AnnotateTextRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getAnnotateTextMethod(), getCallOptions(), request); + } + } + + /** + *
+   * Provides text analysis operations such as sentiment analysis and entity
+   * recognition.
+   * 
+ */ + public static final class LanguageServiceFutureStub extends io.grpc.stub.AbstractFutureStub { + private LanguageServiceFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected LanguageServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LanguageServiceFutureStub(channel, callOptions); + } + + /** + *
+     * Analyzes the sentiment of the provided text.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture analyzeSentiment( + com.google.cloud.language.v1.AnalyzeSentimentRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getAnalyzeSentimentMethod(), getCallOptions()), request); + } + + /** + *
+     * Finds named entities (currently proper names and common nouns) in the text
+     * along with entity types, salience, mentions for each entity, and
+     * other properties.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture analyzeEntities( + com.google.cloud.language.v1.AnalyzeEntitiesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getAnalyzeEntitiesMethod(), getCallOptions()), request); + } + + /** + *
+     * Finds entities, similar to [AnalyzeEntities][google.cloud.language.v1.LanguageService.AnalyzeEntities] in the text and analyzes
+     * sentiment associated with each entity and its mentions.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture analyzeEntitySentiment( + com.google.cloud.language.v1.AnalyzeEntitySentimentRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getAnalyzeEntitySentimentMethod(), getCallOptions()), request); + } + + /** + *
+     * Analyzes the syntax of the text and provides sentence boundaries and
+     * tokenization along with part of speech tags, dependency trees, and other
+     * properties.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture analyzeSyntax( + com.google.cloud.language.v1.AnalyzeSyntaxRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getAnalyzeSyntaxMethod(), getCallOptions()), request); + } + + /** + *
+     * Classifies a document into categories.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture classifyText( + com.google.cloud.language.v1.ClassifyTextRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getClassifyTextMethod(), getCallOptions()), request); + } + + /** + *
+     * A convenience method that provides all the features that analyzeSentiment,
+     * analyzeEntities, and analyzeSyntax provide in one call.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture annotateText( + com.google.cloud.language.v1.AnnotateTextRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getAnnotateTextMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_ANALYZE_SENTIMENT = 0; + private static final int METHODID_ANALYZE_ENTITIES = 1; + private static final int METHODID_ANALYZE_ENTITY_SENTIMENT = 2; + private static final int METHODID_ANALYZE_SYNTAX = 3; + private static final int METHODID_CLASSIFY_TEXT = 4; + private static final int METHODID_ANNOTATE_TEXT = 5; + + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final LanguageServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(LanguageServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_ANALYZE_SENTIMENT: + serviceImpl.analyzeSentiment((com.google.cloud.language.v1.AnalyzeSentimentRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_ANALYZE_ENTITIES: + serviceImpl.analyzeEntities((com.google.cloud.language.v1.AnalyzeEntitiesRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_ANALYZE_ENTITY_SENTIMENT: + serviceImpl.analyzeEntitySentiment((com.google.cloud.language.v1.AnalyzeEntitySentimentRequest) request, + (io.grpc.stub.StreamObserver) 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 static abstract class LanguageServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { + LanguageServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("LanguageService"); + } + } + + private static final class LanguageServiceFileDescriptorSupplier + extends LanguageServiceBaseDescriptorSupplier { + LanguageServiceFileDescriptorSupplier() {} + } + + private static final class LanguageServiceMethodDescriptorSupplier + extends LanguageServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + LanguageServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (LanguageServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new LanguageServiceFileDescriptorSupplier()) + .addMethod(getAnalyzeSentimentMethod()) + .addMethod(getAnalyzeEntitiesMethod()) + .addMethod(getAnalyzeEntitySentimentMethod()) + .addMethod(getAnalyzeSyntaxMethod()) + .addMethod(getClassifyTextMethod()) + .addMethod(getAnnotateTextMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java new file mode 100644 index 000000000000..6875030d3e64 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequest.java @@ -0,0 +1,789 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The entity analysis request message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitiesRequest} + */ +public final class AnalyzeEntitiesRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitiesRequest) + AnalyzeEntitiesRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeEntitiesRequest.newBuilder() to construct. + private AnalyzeEntitiesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeEntitiesRequest() { + encodingType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeEntitiesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeEntitiesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.Document.Builder subBuilder = null; + if (document_ != null) { + subBuilder = document_.toBuilder(); + } + document_ = input.readMessage(com.google.cloud.language.v1.Document.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(document_); + document_ = subBuilder.buildPartial(); + } + + break; + } + case 16: { + int rawValue = input.readEnum(); + + encodingType_ = rawValue; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_; + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + @java.lang.Override + public boolean hasDocument() { + return document_ != null; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + @java.lang.Override + public com.google.cloud.language.v1.Document getDocument() { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + return getDocument(); + } + + public static final int ENCODING_TYPE_FIELD_NUMBER = 2; + private int encodingType_; + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (document_ != null) { + output.writeMessage(1, getDocument()); + } + if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { + output.writeEnum(2, encodingType_); + } + 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_; + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + public boolean hasDocument() { + return documentBuilder_ != null || document_ != null; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + public com.google.cloud.language.v1.Document getDocument() { + if (documentBuilder_ == null) { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } else { + return documentBuilder_.getMessage(); + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + document_ = value; + onChanged(); + } else { + documentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument( + com.google.cloud.language.v1.Document.Builder builderForValue) { + if (documentBuilder_ == null) { + document_ = builderForValue.build(); + onChanged(); + } else { + documentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (document_ != null) { + document_ = + com.google.cloud.language.v1.Document.newBuilder(document_).mergeFrom(value).buildPartial(); + } else { + document_ = value; + } + onChanged(); + } else { + documentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearDocument() { + if (documentBuilder_ == null) { + document_ = null; + onChanged(); + } else { + document_ = null; + documentBuilder_ = null; + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { + + onChanged(); + return getDocumentFieldBuilder().getBuilder(); + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + if (documentBuilder_ != null) { + return documentBuilder_.getMessageOrBuilder(); + } else { + return document_ == null ? + com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder> + getDocumentFieldBuilder() { + if (documentBuilder_ == null) { + documentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder>( + getDocument(), + getParentForChildren(), + isClean()); + document_ = null; + } + return documentBuilder_; + } + + private int encodingType_ = 0; + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The enum numeric value on the wire for encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingTypeValue(int value) { + + encodingType_ = value; + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override + public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { + if (value == null) { + throw new NullPointerException(); + } + + encodingType_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return This builder for chaining. + */ + public Builder clearEncodingType() { + + encodingType_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeEntitiesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitiesRequest) + private static final com.google.cloud.language.v1.AnalyzeEntitiesRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitiesRequest(); + } + + public static com.google.cloud.language.v1.AnalyzeEntitiesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeEntitiesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java new file mode 100644 index 000000000000..977a7a05e2bf --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesRequestOrBuilder.java @@ -0,0 +1,55 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeEntitiesRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitiesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + boolean hasDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + com.google.cloud.language.v1.Document getDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); + + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + int getEncodingTypeValue(); + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + com.google.cloud.language.v1.EncodingType getEncodingType(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java new file mode 100644 index 000000000000..102cb74099ff --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponse.java @@ -0,0 +1,1052 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The entity analysis response message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitiesResponse} + */ +public final class AnalyzeEntitiesResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitiesResponse) + AnalyzeEntitiesResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeEntitiesResponse.newBuilder() to construct. + private AnalyzeEntitiesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeEntitiesResponse() { + entities_ = java.util.Collections.emptyList(); + language_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeEntitiesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeEntitiesResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + entities_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + entities_.add( + input.readMessage(com.google.cloud.language.v1.Entity.parser(), extensionRegistry)); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + language_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeEntitiesResponse.class, com.google.cloud.language.v1.AnalyzeEntitiesResponse.Builder.class); + } + + public static final int ENTITIES_FIELD_NUMBER = 1; + private java.util.List entities_; + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public java.util.List getEntitiesList() { + return entities_; + } + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public java.util.List + getEntitiesOrBuilderList() { + return entities_; + } + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public int getEntitiesCount() { + return entities_.size(); + } + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.Entity getEntities(int index) { + return entities_.get(index); + } + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index) { + return entities_.get(index); + } + + public static final int LANGUAGE_FIELD_NUMBER = 2; + private volatile java.lang.Object language_; + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The language. + */ + @java.lang.Override + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } + } + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The bytes for language. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < entities_.size(); i++) { + output.writeMessage(1, entities_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.AnalyzeEntitiesResponse)) { + return super.equals(obj); + } + com.google.cloud.language.v1.AnalyzeEntitiesResponse other = (com.google.cloud.language.v1.AnalyzeEntitiesResponse) obj; + + if (!getEntitiesList() + .equals(other.getEntitiesList())) return false; + if (!getLanguage() + .equals(other.getLanguage())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getEntitiesCount() > 0) { + hash = (37 * hash) + ENTITIES_FIELD_NUMBER; + hash = (53 * hash) + getEntitiesList().hashCode(); + } + hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; + hash = (53 * hash) + getLanguage().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.AnalyzeEntitiesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The entity analysis response message.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitiesResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeEntitiesResponse) + com.google.cloud.language.v1.AnalyzeEntitiesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeEntitiesResponse.class, com.google.cloud.language.v1.AnalyzeEntitiesResponse.Builder.class); + } + + // Construct using com.google.cloud.language.v1.AnalyzeEntitiesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getEntitiesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (entitiesBuilder_ == null) { + entities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + entitiesBuilder_.clear(); + } + language_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitiesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitiesResponse getDefaultInstanceForType() { + return com.google.cloud.language.v1.AnalyzeEntitiesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitiesResponse build() { + com.google.cloud.language.v1.AnalyzeEntitiesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitiesResponse buildPartial() { + com.google.cloud.language.v1.AnalyzeEntitiesResponse result = new com.google.cloud.language.v1.AnalyzeEntitiesResponse(this); + int from_bitField0_ = bitField0_; + if (entitiesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.entities_ = entities_; + } else { + result.entities_ = entitiesBuilder_.build(); + } + result.language_ = language_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.AnalyzeEntitiesResponse) { + return mergeFrom((com.google.cloud.language.v1.AnalyzeEntitiesResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeEntitiesResponse other) { + if (other == com.google.cloud.language.v1.AnalyzeEntitiesResponse.getDefaultInstance()) return this; + if (entitiesBuilder_ == null) { + if (!other.entities_.isEmpty()) { + if (entities_.isEmpty()) { + entities_ = other.entities_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureEntitiesIsMutable(); + entities_.addAll(other.entities_); + } + onChanged(); + } + } else { + if (!other.entities_.isEmpty()) { + if (entitiesBuilder_.isEmpty()) { + entitiesBuilder_.dispose(); + entitiesBuilder_ = null; + entities_ = other.entities_; + bitField0_ = (bitField0_ & ~0x00000001); + entitiesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getEntitiesFieldBuilder() : null; + } else { + entitiesBuilder_.addAllMessages(other.entities_); + } + } + } + if (!other.getLanguage().isEmpty()) { + language_ = other.language_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.AnalyzeEntitiesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.AnalyzeEntitiesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List entities_ = + java.util.Collections.emptyList(); + private void ensureEntitiesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + entities_ = new java.util.ArrayList(entities_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder> entitiesBuilder_; + + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public java.util.List getEntitiesList() { + if (entitiesBuilder_ == null) { + return java.util.Collections.unmodifiableList(entities_); + } else { + return entitiesBuilder_.getMessageList(); + } + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public int getEntitiesCount() { + if (entitiesBuilder_ == null) { + return entities_.size(); + } else { + return entitiesBuilder_.getCount(); + } + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity getEntities(int index) { + if (entitiesBuilder_ == null) { + return entities_.get(index); + } else { + return entitiesBuilder_.getMessage(index); + } + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder setEntities( + int index, com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.set(index, value); + onChanged(); + } else { + entitiesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder setEntities( + int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.set(index, builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities(com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.add(value); + onChanged(); + } else { + entitiesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities( + int index, com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.add(index, value); + onChanged(); + } else { + entitiesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities( + com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.add(builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities( + int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.add(index, builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addAllEntities( + java.lang.Iterable values) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, entities_); + onChanged(); + } else { + entitiesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder clearEntities() { + if (entitiesBuilder_ == null) { + entities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + entitiesBuilder_.clear(); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder removeEntities(int index) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.remove(index); + onChanged(); + } else { + entitiesBuilder_.remove(index); + } + return this; + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity.Builder getEntitiesBuilder( + int index) { + return getEntitiesFieldBuilder().getBuilder(index); + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index) { + if (entitiesBuilder_ == null) { + return entities_.get(index); } else { + return entitiesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public java.util.List + getEntitiesOrBuilderList() { + if (entitiesBuilder_ != null) { + return entitiesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(entities_); + } + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder() { + return getEntitiesFieldBuilder().addBuilder( + com.google.cloud.language.v1.Entity.getDefaultInstance()); + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder( + int index) { + return getEntitiesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Entity.getDefaultInstance()); + } + /** + *
+     * The recognized entities in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public java.util.List + getEntitiesBuilderList() { + return getEntitiesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder> + getEntitiesFieldBuilder() { + if (entitiesBuilder_ == null) { + entitiesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder>( + entities_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + entities_ = null; + } + return entitiesBuilder_; + } + + private java.lang.Object language_ = ""; + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return The language. + */ + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return The bytes for language. + */ + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @param value The language to set. + * @return This builder for chaining. + */ + public Builder setLanguage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + language_ = value; + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return This builder for chaining. + */ + public Builder clearLanguage() { + + language_ = getDefaultInstance().getLanguage(); + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @param value The bytes for language to set. + * @return This builder for chaining. + */ + public Builder setLanguageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + language_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeEntitiesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitiesResponse) + private static final com.google.cloud.language.v1.AnalyzeEntitiesResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitiesResponse(); + } + + public static com.google.cloud.language.v1.AnalyzeEntitiesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeEntitiesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AnalyzeEntitiesResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitiesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java new file mode 100644 index 000000000000..65babe79ab08 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitiesResponseOrBuilder.java @@ -0,0 +1,77 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeEntitiesResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitiesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + java.util.List + getEntitiesList(); + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + com.google.cloud.language.v1.Entity getEntities(int index); + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + int getEntitiesCount(); + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + java.util.List + getEntitiesOrBuilderList(); + /** + *
+   * The recognized entities in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index); + + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The language. + */ + java.lang.String getLanguage(); + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The bytes for language. + */ + com.google.protobuf.ByteString + getLanguageBytes(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java new file mode 100644 index 000000000000..5fbc903a2127 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequest.java @@ -0,0 +1,789 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The entity-level sentiment analysis request message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitySentimentRequest} + */ +public final class AnalyzeEntitySentimentRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitySentimentRequest) + AnalyzeEntitySentimentRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeEntitySentimentRequest.newBuilder() to construct. + private AnalyzeEntitySentimentRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeEntitySentimentRequest() { + encodingType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeEntitySentimentRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeEntitySentimentRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.Document.Builder subBuilder = null; + if (document_ != null) { + subBuilder = document_.toBuilder(); + } + document_ = input.readMessage(com.google.cloud.language.v1.Document.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(document_); + document_ = subBuilder.buildPartial(); + } + + break; + } + case 16: { + int rawValue = input.readEnum(); + + encodingType_ = rawValue; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_; + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + @java.lang.Override + public boolean hasDocument() { + return document_ != null; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + @java.lang.Override + public com.google.cloud.language.v1.Document getDocument() { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + return getDocument(); + } + + public static final int ENCODING_TYPE_FIELD_NUMBER = 2; + private int encodingType_; + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (document_ != null) { + output.writeMessage(1, getDocument()); + } + if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { + output.writeEnum(2, encodingType_); + } + 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_; + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + public boolean hasDocument() { + return documentBuilder_ != null || document_ != null; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + public com.google.cloud.language.v1.Document getDocument() { + if (documentBuilder_ == null) { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } else { + return documentBuilder_.getMessage(); + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + document_ = value; + onChanged(); + } else { + documentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument( + com.google.cloud.language.v1.Document.Builder builderForValue) { + if (documentBuilder_ == null) { + document_ = builderForValue.build(); + onChanged(); + } else { + documentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (document_ != null) { + document_ = + com.google.cloud.language.v1.Document.newBuilder(document_).mergeFrom(value).buildPartial(); + } else { + document_ = value; + } + onChanged(); + } else { + documentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearDocument() { + if (documentBuilder_ == null) { + document_ = null; + onChanged(); + } else { + document_ = null; + documentBuilder_ = null; + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { + + onChanged(); + return getDocumentFieldBuilder().getBuilder(); + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + if (documentBuilder_ != null) { + return documentBuilder_.getMessageOrBuilder(); + } else { + return document_ == null ? + com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder> + getDocumentFieldBuilder() { + if (documentBuilder_ == null) { + documentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder>( + getDocument(), + getParentForChildren(), + isClean()); + document_ = null; + } + return documentBuilder_; + } + + private int encodingType_ = 0; + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The enum numeric value on the wire for encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingTypeValue(int value) { + + encodingType_ = value; + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override + public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { + if (value == null) { + throw new NullPointerException(); + } + + encodingType_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return This builder for chaining. + */ + public Builder clearEncodingType() { + + encodingType_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeEntitySentimentRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitySentimentRequest) + private static final com.google.cloud.language.v1.AnalyzeEntitySentimentRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitySentimentRequest(); + } + + public static com.google.cloud.language.v1.AnalyzeEntitySentimentRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeEntitySentimentRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java new file mode 100644 index 000000000000..ba89b9d3cb6b --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentRequestOrBuilder.java @@ -0,0 +1,55 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeEntitySentimentRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitySentimentRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + boolean hasDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + com.google.cloud.language.v1.Document getDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); + + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + int getEncodingTypeValue(); + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + com.google.cloud.language.v1.EncodingType getEncodingType(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java new file mode 100644 index 000000000000..9dcfa5d5f751 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponse.java @@ -0,0 +1,1052 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The entity-level sentiment analysis response message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitySentimentResponse} + */ +public final class AnalyzeEntitySentimentResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeEntitySentimentResponse) + AnalyzeEntitySentimentResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeEntitySentimentResponse.newBuilder() to construct. + private AnalyzeEntitySentimentResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeEntitySentimentResponse() { + entities_ = java.util.Collections.emptyList(); + language_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeEntitySentimentResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeEntitySentimentResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + entities_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + entities_.add( + input.readMessage(com.google.cloud.language.v1.Entity.parser(), extensionRegistry)); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + language_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.class, com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.Builder.class); + } + + public static final int ENTITIES_FIELD_NUMBER = 1; + private java.util.List entities_; + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public java.util.List getEntitiesList() { + return entities_; + } + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public java.util.List + getEntitiesOrBuilderList() { + return entities_; + } + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public int getEntitiesCount() { + return entities_.size(); + } + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.Entity getEntities(int index) { + return entities_.get(index); + } + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index) { + return entities_.get(index); + } + + public static final int LANGUAGE_FIELD_NUMBER = 2; + private volatile java.lang.Object language_; + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The language. + */ + @java.lang.Override + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } + } + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The bytes for language. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < entities_.size(); i++) { + output.writeMessage(1, entities_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.AnalyzeEntitySentimentResponse)) { + return super.equals(obj); + } + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse other = (com.google.cloud.language.v1.AnalyzeEntitySentimentResponse) obj; + + if (!getEntitiesList() + .equals(other.getEntitiesList())) return false; + if (!getLanguage() + .equals(other.getLanguage())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getEntitiesCount() > 0) { + hash = (37 * hash) + ENTITIES_FIELD_NUMBER; + hash = (53 * hash) + getEntitiesList().hashCode(); + } + hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; + hash = (53 * hash) + getLanguage().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.AnalyzeEntitySentimentResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The entity-level sentiment analysis response message.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeEntitySentimentResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeEntitySentimentResponse) + com.google.cloud.language.v1.AnalyzeEntitySentimentResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.class, com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.Builder.class); + } + + // Construct using com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getEntitiesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (entitiesBuilder_ == null) { + entities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + entitiesBuilder_.clear(); + } + language_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeEntitySentimentResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse getDefaultInstanceForType() { + return com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse build() { + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse buildPartial() { + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse result = new com.google.cloud.language.v1.AnalyzeEntitySentimentResponse(this); + int from_bitField0_ = bitField0_; + if (entitiesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.entities_ = entities_; + } else { + result.entities_ = entitiesBuilder_.build(); + } + result.language_ = language_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.AnalyzeEntitySentimentResponse) { + return mergeFrom((com.google.cloud.language.v1.AnalyzeEntitySentimentResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeEntitySentimentResponse other) { + if (other == com.google.cloud.language.v1.AnalyzeEntitySentimentResponse.getDefaultInstance()) return this; + if (entitiesBuilder_ == null) { + if (!other.entities_.isEmpty()) { + if (entities_.isEmpty()) { + entities_ = other.entities_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureEntitiesIsMutable(); + entities_.addAll(other.entities_); + } + onChanged(); + } + } else { + if (!other.entities_.isEmpty()) { + if (entitiesBuilder_.isEmpty()) { + entitiesBuilder_.dispose(); + entitiesBuilder_ = null; + entities_ = other.entities_; + bitField0_ = (bitField0_ & ~0x00000001); + entitiesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getEntitiesFieldBuilder() : null; + } else { + entitiesBuilder_.addAllMessages(other.entities_); + } + } + } + if (!other.getLanguage().isEmpty()) { + language_ = other.language_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.AnalyzeEntitySentimentResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.AnalyzeEntitySentimentResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List entities_ = + java.util.Collections.emptyList(); + private void ensureEntitiesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + entities_ = new java.util.ArrayList(entities_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder> entitiesBuilder_; + + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public java.util.List getEntitiesList() { + if (entitiesBuilder_ == null) { + return java.util.Collections.unmodifiableList(entities_); + } else { + return entitiesBuilder_.getMessageList(); + } + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public int getEntitiesCount() { + if (entitiesBuilder_ == null) { + return entities_.size(); + } else { + return entitiesBuilder_.getCount(); + } + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity getEntities(int index) { + if (entitiesBuilder_ == null) { + return entities_.get(index); + } else { + return entitiesBuilder_.getMessage(index); + } + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder setEntities( + int index, com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.set(index, value); + onChanged(); + } else { + entitiesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder setEntities( + int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.set(index, builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities(com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.add(value); + onChanged(); + } else { + entitiesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities( + int index, com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.add(index, value); + onChanged(); + } else { + entitiesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities( + com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.add(builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addEntities( + int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.add(index, builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder addAllEntities( + java.lang.Iterable values) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, entities_); + onChanged(); + } else { + entitiesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder clearEntities() { + if (entitiesBuilder_ == null) { + entities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + entitiesBuilder_.clear(); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public Builder removeEntities(int index) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.remove(index); + onChanged(); + } else { + entitiesBuilder_.remove(index); + } + return this; + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity.Builder getEntitiesBuilder( + int index) { + return getEntitiesFieldBuilder().getBuilder(index); + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index) { + if (entitiesBuilder_ == null) { + return entities_.get(index); } else { + return entitiesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public java.util.List + getEntitiesOrBuilderList() { + if (entitiesBuilder_ != null) { + return entitiesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(entities_); + } + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder() { + return getEntitiesFieldBuilder().addBuilder( + com.google.cloud.language.v1.Entity.getDefaultInstance()); + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder( + int index) { + return getEntitiesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Entity.getDefaultInstance()); + } + /** + *
+     * The recognized entities in the input document with associated sentiments.
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + public java.util.List + getEntitiesBuilderList() { + return getEntitiesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder> + getEntitiesFieldBuilder() { + if (entitiesBuilder_ == null) { + entitiesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder>( + entities_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + entities_ = null; + } + return entitiesBuilder_; + } + + private java.lang.Object language_ = ""; + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return The language. + */ + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return The bytes for language. + */ + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @param value The language to set. + * @return This builder for chaining. + */ + public Builder setLanguage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + language_ = value; + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return This builder for chaining. + */ + public Builder clearLanguage() { + + language_ = getDefaultInstance().getLanguage(); + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @param value The bytes for language to set. + * @return This builder for chaining. + */ + public Builder setLanguageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + language_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeEntitySentimentResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeEntitySentimentResponse) + private static final com.google.cloud.language.v1.AnalyzeEntitySentimentResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeEntitySentimentResponse(); + } + + public static com.google.cloud.language.v1.AnalyzeEntitySentimentResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeEntitySentimentResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AnalyzeEntitySentimentResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeEntitySentimentResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java new file mode 100644 index 000000000000..6bf3d4c49d33 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeEntitySentimentResponseOrBuilder.java @@ -0,0 +1,77 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeEntitySentimentResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeEntitySentimentResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + java.util.List + getEntitiesList(); + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + com.google.cloud.language.v1.Entity getEntities(int index); + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + int getEntitiesCount(); + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + java.util.List + getEntitiesOrBuilderList(); + /** + *
+   * The recognized entities in the input document with associated sentiments.
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 1; + */ + com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index); + + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The language. + */ + java.lang.String getLanguage(); + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The bytes for language. + */ + com.google.protobuf.ByteString + getLanguageBytes(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java new file mode 100644 index 000000000000..68728668d949 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequest.java @@ -0,0 +1,789 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The sentiment analysis request message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentRequest} + */ +public final class AnalyzeSentimentRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSentimentRequest) + AnalyzeSentimentRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeSentimentRequest.newBuilder() to construct. + private AnalyzeSentimentRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeSentimentRequest() { + encodingType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeSentimentRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeSentimentRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.Document.Builder subBuilder = null; + if (document_ != null) { + subBuilder = document_.toBuilder(); + } + document_ = input.readMessage(com.google.cloud.language.v1.Document.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(document_); + document_ = subBuilder.buildPartial(); + } + + break; + } + case 16: { + int rawValue = input.readEnum(); + + encodingType_ = rawValue; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_; + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + @java.lang.Override + public boolean hasDocument() { + return document_ != null; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + @java.lang.Override + public com.google.cloud.language.v1.Document getDocument() { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + return getDocument(); + } + + public static final int ENCODING_TYPE_FIELD_NUMBER = 2; + private int encodingType_; + /** + *
+   * The encoding type used by the API to calculate sentence offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+   * The encoding type used by the API to calculate sentence offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (document_ != null) { + output.writeMessage(1, getDocument()); + } + if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { + output.writeEnum(2, encodingType_); + } + 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_; + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + public boolean hasDocument() { + return documentBuilder_ != null || document_ != null; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + public com.google.cloud.language.v1.Document getDocument() { + if (documentBuilder_ == null) { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } else { + return documentBuilder_.getMessage(); + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + document_ = value; + onChanged(); + } else { + documentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument( + com.google.cloud.language.v1.Document.Builder builderForValue) { + if (documentBuilder_ == null) { + document_ = builderForValue.build(); + onChanged(); + } else { + documentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (document_ != null) { + document_ = + com.google.cloud.language.v1.Document.newBuilder(document_).mergeFrom(value).buildPartial(); + } else { + document_ = value; + } + onChanged(); + } else { + documentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearDocument() { + if (documentBuilder_ == null) { + document_ = null; + onChanged(); + } else { + document_ = null; + documentBuilder_ = null; + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { + + onChanged(); + return getDocumentFieldBuilder().getBuilder(); + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + if (documentBuilder_ != null) { + return documentBuilder_.getMessageOrBuilder(); + } else { + return document_ == null ? + com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder> + getDocumentFieldBuilder() { + if (documentBuilder_ == null) { + documentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder>( + getDocument(), + getParentForChildren(), + isClean()); + document_ = null; + } + return documentBuilder_; + } + + private int encodingType_ = 0; + /** + *
+     * The encoding type used by the API to calculate sentence offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+     * The encoding type used by the API to calculate sentence offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The enum numeric value on the wire for encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingTypeValue(int value) { + + encodingType_ = value; + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate sentence offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override + public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + /** + *
+     * The encoding type used by the API to calculate sentence offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { + if (value == null) { + throw new NullPointerException(); + } + + encodingType_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate sentence offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return This builder for chaining. + */ + public Builder clearEncodingType() { + + encodingType_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeSentimentRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSentimentRequest) + private static final com.google.cloud.language.v1.AnalyzeSentimentRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSentimentRequest(); + } + + public static com.google.cloud.language.v1.AnalyzeSentimentRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeSentimentRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java new file mode 100644 index 000000000000..b358dd95ea45 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentRequestOrBuilder.java @@ -0,0 +1,55 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeSentimentRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSentimentRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + boolean hasDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + com.google.cloud.language.v1.Document getDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); + + /** + *
+   * The encoding type used by the API to calculate sentence offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + int getEncodingTypeValue(); + /** + *
+   * The encoding type used by the API to calculate sentence offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + com.google.cloud.language.v1.EncodingType getEncodingType(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java new file mode 100644 index 000000000000..fde4a139e4c2 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponse.java @@ -0,0 +1,1288 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The sentiment analysis response message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentResponse} + */ +public final class AnalyzeSentimentResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSentimentResponse) + AnalyzeSentimentResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeSentimentResponse.newBuilder() to construct. + private AnalyzeSentimentResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeSentimentResponse() { + language_ = ""; + sentences_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeSentimentResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeSentimentResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.Sentiment.Builder subBuilder = null; + if (documentSentiment_ != null) { + subBuilder = documentSentiment_.toBuilder(); + } + documentSentiment_ = input.readMessage(com.google.cloud.language.v1.Sentiment.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(documentSentiment_); + documentSentiment_ = subBuilder.buildPartial(); + } + + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + language_ = s; + break; + } + case 26: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + sentences_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + sentences_.add( + input.readMessage(com.google.cloud.language.v1.Sentence.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + sentences_ = java.util.Collections.unmodifiableList(sentences_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeSentimentResponse.class, com.google.cloud.language.v1.AnalyzeSentimentResponse.Builder.class); + } + + public static final int DOCUMENT_SENTIMENT_FIELD_NUMBER = 1; + private com.google.cloud.language.v1.Sentiment documentSentiment_; + /** + *
+   * The overall sentiment of the input document.
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @return Whether the documentSentiment field is set. + */ + @java.lang.Override + public boolean hasDocumentSentiment() { + return documentSentiment_ != null; + } + /** + *
+   * The overall sentiment of the input document.
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @return The documentSentiment. + */ + @java.lang.Override + public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { + return documentSentiment_ == null ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_; + } + /** + *
+   * The overall sentiment of the input document.
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { + return getDocumentSentiment(); + } + + public static final int LANGUAGE_FIELD_NUMBER = 2; + private volatile java.lang.Object language_; + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The language. + */ + @java.lang.Override + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } + } + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The bytes for language. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SENTENCES_FIELD_NUMBER = 3; + private java.util.List sentences_; + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + @java.lang.Override + public java.util.List getSentencesList() { + return sentences_; + } + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + @java.lang.Override + public java.util.List + getSentencesOrBuilderList() { + return sentences_; + } + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + @java.lang.Override + public int getSentencesCount() { + return sentences_.size(); + } + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + @java.lang.Override + public com.google.cloud.language.v1.Sentence getSentences(int index) { + return sentences_.get(index); + } + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + @java.lang.Override + public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index) { + return sentences_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (documentSentiment_ != null) { + output.writeMessage(1, getDocumentSentiment()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, language_); + } + for (int i = 0; i < sentences_.size(); i++) { + output.writeMessage(3, sentences_.get(i)); + } + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, language_); + } + for (int i = 0; i < sentences_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, sentences_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSentimentResponse)) { + return super.equals(obj); + } + com.google.cloud.language.v1.AnalyzeSentimentResponse other = (com.google.cloud.language.v1.AnalyzeSentimentResponse) obj; + + if (hasDocumentSentiment() != other.hasDocumentSentiment()) return false; + if (hasDocumentSentiment()) { + if (!getDocumentSentiment() + .equals(other.getDocumentSentiment())) return false; + } + if (!getLanguage() + .equals(other.getLanguage())) return false; + if (!getSentencesList() + .equals(other.getSentencesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasDocumentSentiment()) { + hash = (37 * hash) + DOCUMENT_SENTIMENT_FIELD_NUMBER; + hash = (53 * hash) + getDocumentSentiment().hashCode(); + } + hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; + hash = (53 * hash) + getLanguage().hashCode(); + if (getSentencesCount() > 0) { + hash = (37 * hash) + SENTENCES_FIELD_NUMBER; + hash = (53 * hash) + getSentencesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeSentimentResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.AnalyzeSentimentResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The sentiment analysis response message.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeSentimentResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeSentimentResponse) + com.google.cloud.language.v1.AnalyzeSentimentResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeSentimentResponse.class, com.google.cloud.language.v1.AnalyzeSentimentResponse.Builder.class); + } + + // Construct using com.google.cloud.language.v1.AnalyzeSentimentResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getSentencesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (documentSentimentBuilder_ == null) { + documentSentiment_ = null; + } else { + documentSentiment_ = null; + documentSentimentBuilder_ = null; + } + language_ = ""; + + if (sentencesBuilder_ == null) { + sentences_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + sentencesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSentimentResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstanceForType() { + return com.google.cloud.language.v1.AnalyzeSentimentResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSentimentResponse build() { + com.google.cloud.language.v1.AnalyzeSentimentResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSentimentResponse buildPartial() { + com.google.cloud.language.v1.AnalyzeSentimentResponse result = new com.google.cloud.language.v1.AnalyzeSentimentResponse(this); + int from_bitField0_ = bitField0_; + if (documentSentimentBuilder_ == null) { + result.documentSentiment_ = documentSentiment_; + } else { + result.documentSentiment_ = documentSentimentBuilder_.build(); + } + result.language_ = language_; + if (sentencesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + sentences_ = java.util.Collections.unmodifiableList(sentences_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.sentences_ = sentences_; + } else { + result.sentences_ = sentencesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.AnalyzeSentimentResponse) { + return mergeFrom((com.google.cloud.language.v1.AnalyzeSentimentResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSentimentResponse other) { + if (other == com.google.cloud.language.v1.AnalyzeSentimentResponse.getDefaultInstance()) return this; + if (other.hasDocumentSentiment()) { + mergeDocumentSentiment(other.getDocumentSentiment()); + } + if (!other.getLanguage().isEmpty()) { + language_ = other.language_; + onChanged(); + } + if (sentencesBuilder_ == null) { + if (!other.sentences_.isEmpty()) { + if (sentences_.isEmpty()) { + sentences_ = other.sentences_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSentencesIsMutable(); + sentences_.addAll(other.sentences_); + } + onChanged(); + } + } else { + if (!other.sentences_.isEmpty()) { + if (sentencesBuilder_.isEmpty()) { + sentencesBuilder_.dispose(); + sentencesBuilder_ = null; + sentences_ = other.sentences_; + bitField0_ = (bitField0_ & ~0x00000001); + sentencesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getSentencesFieldBuilder() : null; + } else { + sentencesBuilder_.addAllMessages(other.sentences_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.AnalyzeSentimentResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.AnalyzeSentimentResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private com.google.cloud.language.v1.Sentiment documentSentiment_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder> documentSentimentBuilder_; + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @return Whether the documentSentiment field is set. + */ + public boolean hasDocumentSentiment() { + return documentSentimentBuilder_ != null || documentSentiment_ != null; + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @return The documentSentiment. + */ + public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { + if (documentSentimentBuilder_ == null) { + return documentSentiment_ == null ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_; + } else { + return documentSentimentBuilder_.getMessage(); + } + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + public Builder setDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { + if (documentSentimentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + documentSentiment_ = value; + onChanged(); + } else { + documentSentimentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + public Builder setDocumentSentiment( + com.google.cloud.language.v1.Sentiment.Builder builderForValue) { + if (documentSentimentBuilder_ == null) { + documentSentiment_ = builderForValue.build(); + onChanged(); + } else { + documentSentimentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + public Builder mergeDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { + if (documentSentimentBuilder_ == null) { + if (documentSentiment_ != null) { + documentSentiment_ = + com.google.cloud.language.v1.Sentiment.newBuilder(documentSentiment_).mergeFrom(value).buildPartial(); + } else { + documentSentiment_ = value; + } + onChanged(); + } else { + documentSentimentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + public Builder clearDocumentSentiment() { + if (documentSentimentBuilder_ == null) { + documentSentiment_ = null; + onChanged(); + } else { + documentSentiment_ = null; + documentSentimentBuilder_ = null; + } + + return this; + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + public com.google.cloud.language.v1.Sentiment.Builder getDocumentSentimentBuilder() { + + onChanged(); + return getDocumentSentimentFieldBuilder().getBuilder(); + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { + if (documentSentimentBuilder_ != null) { + return documentSentimentBuilder_.getMessageOrBuilder(); + } else { + return documentSentiment_ == null ? + com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_; + } + } + /** + *
+     * The overall sentiment of the input document.
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder> + getDocumentSentimentFieldBuilder() { + if (documentSentimentBuilder_ == null) { + documentSentimentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder>( + getDocumentSentiment(), + getParentForChildren(), + isClean()); + documentSentiment_ = null; + } + return documentSentimentBuilder_; + } + + private java.lang.Object language_ = ""; + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return The language. + */ + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return The bytes for language. + */ + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @param value The language to set. + * @return This builder for chaining. + */ + public Builder setLanguage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + language_ = value; + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @return This builder for chaining. + */ + public Builder clearLanguage() { + + language_ = getDefaultInstance().getLanguage(); + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 2; + * @param value The bytes for language to set. + * @return This builder for chaining. + */ + public Builder setLanguageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + language_ = value; + onChanged(); + return this; + } + + private java.util.List sentences_ = + java.util.Collections.emptyList(); + private void ensureSentencesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + sentences_ = new java.util.ArrayList(sentences_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> sentencesBuilder_; + + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public java.util.List getSentencesList() { + if (sentencesBuilder_ == null) { + return java.util.Collections.unmodifiableList(sentences_); + } else { + return sentencesBuilder_.getMessageList(); + } + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public int getSentencesCount() { + if (sentencesBuilder_ == null) { + return sentences_.size(); + } else { + return sentencesBuilder_.getCount(); + } + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public com.google.cloud.language.v1.Sentence getSentences(int index) { + if (sentencesBuilder_ == null) { + return sentences_.get(index); + } else { + return sentencesBuilder_.getMessage(index); + } + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder setSentences( + int index, com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.set(index, value); + onChanged(); + } else { + sentencesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder setSentences( + int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.set(index, builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder addSentences(com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.add(value); + onChanged(); + } else { + sentencesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder addSentences( + int index, com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.add(index, value); + onChanged(); + } else { + sentencesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder addSentences( + com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.add(builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder addSentences( + int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.add(index, builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder addAllSentences( + java.lang.Iterable values) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, sentences_); + onChanged(); + } else { + sentencesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder clearSentences() { + if (sentencesBuilder_ == null) { + sentences_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + sentencesBuilder_.clear(); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public Builder removeSentences(int index) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.remove(index); + onChanged(); + } else { + sentencesBuilder_.remove(index); + } + return this; + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder( + int index) { + return getSentencesFieldBuilder().getBuilder(index); + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index) { + if (sentencesBuilder_ == null) { + return sentences_.get(index); } else { + return sentencesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public java.util.List + getSentencesOrBuilderList() { + if (sentencesBuilder_ != null) { + return sentencesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(sentences_); + } + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() { + return getSentencesFieldBuilder().addBuilder( + com.google.cloud.language.v1.Sentence.getDefaultInstance()); + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder( + int index) { + return getSentencesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Sentence.getDefaultInstance()); + } + /** + *
+     * The sentiment for all the sentences in the document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + public java.util.List + getSentencesBuilderList() { + return getSentencesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> + getSentencesFieldBuilder() { + if (sentencesBuilder_ == null) { + sentencesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder>( + sentences_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + sentences_ = null; + } + return sentencesBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeSentimentResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSentimentResponse) + private static final com.google.cloud.language.v1.AnalyzeSentimentResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSentimentResponse(); + } + + public static com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeSentimentResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AnalyzeSentimentResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSentimentResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java new file mode 100644 index 000000000000..d0500fbcc002 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSentimentResponseOrBuilder.java @@ -0,0 +1,104 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeSentimentResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSentimentResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The overall sentiment of the input document.
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @return Whether the documentSentiment field is set. + */ + boolean hasDocumentSentiment(); + /** + *
+   * The overall sentiment of the input document.
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + * @return The documentSentiment. + */ + com.google.cloud.language.v1.Sentiment getDocumentSentiment(); + /** + *
+   * The overall sentiment of the input document.
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 1; + */ + com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder(); + + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The language. + */ + java.lang.String getLanguage(); + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 2; + * @return The bytes for language. + */ + com.google.protobuf.ByteString + getLanguageBytes(); + + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + java.util.List + getSentencesList(); + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + com.google.cloud.language.v1.Sentence getSentences(int index); + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + int getSentencesCount(); + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + java.util.List + getSentencesOrBuilderList(); + /** + *
+   * The sentiment for all the sentences in the document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 3; + */ + com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java new file mode 100644 index 000000000000..c74f85af719a --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequest.java @@ -0,0 +1,789 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The syntax analysis request message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeSyntaxRequest} + */ +public final class AnalyzeSyntaxRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSyntaxRequest) + AnalyzeSyntaxRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeSyntaxRequest.newBuilder() to construct. + private AnalyzeSyntaxRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeSyntaxRequest() { + encodingType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeSyntaxRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeSyntaxRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.Document.Builder subBuilder = null; + if (document_ != null) { + subBuilder = document_.toBuilder(); + } + document_ = input.readMessage(com.google.cloud.language.v1.Document.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(document_); + document_ = subBuilder.buildPartial(); + } + + break; + } + case 16: { + int rawValue = input.readEnum(); + + encodingType_ = rawValue; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_; + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + @java.lang.Override + public boolean hasDocument() { + return document_ != null; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + @java.lang.Override + public com.google.cloud.language.v1.Document getDocument() { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + return getDocument(); + } + + public static final int ENCODING_TYPE_FIELD_NUMBER = 2; + private int encodingType_; + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (document_ != null) { + output.writeMessage(1, getDocument()); + } + if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { + output.writeEnum(2, encodingType_); + } + 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_; + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + public boolean hasDocument() { + return documentBuilder_ != null || document_ != null; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + public com.google.cloud.language.v1.Document getDocument() { + if (documentBuilder_ == null) { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } else { + return documentBuilder_.getMessage(); + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + document_ = value; + onChanged(); + } else { + documentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument( + com.google.cloud.language.v1.Document.Builder builderForValue) { + if (documentBuilder_ == null) { + document_ = builderForValue.build(); + onChanged(); + } else { + documentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (document_ != null) { + document_ = + com.google.cloud.language.v1.Document.newBuilder(document_).mergeFrom(value).buildPartial(); + } else { + document_ = value; + } + onChanged(); + } else { + documentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearDocument() { + if (documentBuilder_ == null) { + document_ = null; + onChanged(); + } else { + document_ = null; + documentBuilder_ = null; + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { + + onChanged(); + return getDocumentFieldBuilder().getBuilder(); + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + if (documentBuilder_ != null) { + return documentBuilder_.getMessageOrBuilder(); + } else { + return document_ == null ? + com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder> + getDocumentFieldBuilder() { + if (documentBuilder_ == null) { + documentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder>( + getDocument(), + getParentForChildren(), + isClean()); + document_ = null; + } + return documentBuilder_; + } + + private int encodingType_ = 0; + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The enum numeric value on the wire for encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingTypeValue(int value) { + + encodingType_ = value; + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + @java.lang.Override + public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @param value The encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { + if (value == null) { + throw new NullPointerException(); + } + + encodingType_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return This builder for chaining. + */ + public Builder clearEncodingType() { + + encodingType_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeSyntaxRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSyntaxRequest) + private static final com.google.cloud.language.v1.AnalyzeSyntaxRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSyntaxRequest(); + } + + public static com.google.cloud.language.v1.AnalyzeSyntaxRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeSyntaxRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java new file mode 100644 index 000000000000..239aeeecbcf7 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxRequestOrBuilder.java @@ -0,0 +1,55 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeSyntaxRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSyntaxRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + boolean hasDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + com.google.cloud.language.v1.Document getDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); + + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The enum numeric value on the wire for encodingType. + */ + int getEncodingTypeValue(); + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 2; + * @return The encodingType. + */ + com.google.cloud.language.v1.EncodingType getEncodingType(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java new file mode 100644 index 000000000000..84f7a0201dc7 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponse.java @@ -0,0 +1,1492 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The syntax analysis response message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeSyntaxResponse} + */ +public final class AnalyzeSyntaxResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnalyzeSyntaxResponse) + AnalyzeSyntaxResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnalyzeSyntaxResponse.newBuilder() to construct. + private AnalyzeSyntaxResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnalyzeSyntaxResponse() { + sentences_ = java.util.Collections.emptyList(); + tokens_ = java.util.Collections.emptyList(); + language_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnalyzeSyntaxResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnalyzeSyntaxResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + sentences_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + sentences_.add( + input.readMessage(com.google.cloud.language.v1.Sentence.parser(), extensionRegistry)); + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + tokens_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + tokens_.add( + input.readMessage(com.google.cloud.language.v1.Token.parser(), extensionRegistry)); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + language_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + sentences_ = java.util.Collections.unmodifiableList(sentences_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + tokens_ = java.util.Collections.unmodifiableList(tokens_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeSyntaxResponse.class, com.google.cloud.language.v1.AnalyzeSyntaxResponse.Builder.class); + } + + public static final int SENTENCES_FIELD_NUMBER = 1; + private java.util.List sentences_; + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public java.util.List getSentencesList() { + return sentences_; + } + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public java.util.List + getSentencesOrBuilderList() { + return sentences_; + } + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public int getSentencesCount() { + return sentences_.size(); + } + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.Sentence getSentences(int index) { + return sentences_.get(index); + } + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index) { + return sentences_.get(index); + } + + public static final int TOKENS_FIELD_NUMBER = 2; + private java.util.List tokens_; + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public java.util.List getTokensList() { + return tokens_; + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public java.util.List + getTokensOrBuilderList() { + return tokens_; + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public int getTokensCount() { + return tokens_.size(); + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public com.google.cloud.language.v1.Token getTokens(int index) { + return tokens_.get(index); + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder( + int index) { + return tokens_.get(index); + } + + public static final int LANGUAGE_FIELD_NUMBER = 3; + private volatile java.lang.Object language_; + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 3; + * @return The language. + */ + @java.lang.Override + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } + } + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 3; + * @return The bytes for language. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < sentences_.size(); i++) { + output.writeMessage(1, sentences_.get(i)); + } + for (int i = 0; i < tokens_.size(); i++) { + output.writeMessage(2, tokens_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, language_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.AnalyzeSyntaxResponse)) { + return super.equals(obj); + } + com.google.cloud.language.v1.AnalyzeSyntaxResponse other = (com.google.cloud.language.v1.AnalyzeSyntaxResponse) obj; + + if (!getSentencesList() + .equals(other.getSentencesList())) return false; + if (!getTokensList() + .equals(other.getTokensList())) return false; + if (!getLanguage() + .equals(other.getLanguage())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSentencesCount() > 0) { + hash = (37 * hash) + SENTENCES_FIELD_NUMBER; + hash = (53 * hash) + getSentencesList().hashCode(); + } + if (getTokensCount() > 0) { + hash = (37 * hash) + TOKENS_FIELD_NUMBER; + hash = (53 * hash) + getTokensList().hashCode(); + } + hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; + hash = (53 * hash) + getLanguage().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.AnalyzeSyntaxResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The syntax analysis response message.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnalyzeSyntaxResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnalyzeSyntaxResponse) + com.google.cloud.language.v1.AnalyzeSyntaxResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnalyzeSyntaxResponse.class, com.google.cloud.language.v1.AnalyzeSyntaxResponse.Builder.class); + } + + // Construct using com.google.cloud.language.v1.AnalyzeSyntaxResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getSentencesFieldBuilder(); + getTokensFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (sentencesBuilder_ == null) { + sentences_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + sentencesBuilder_.clear(); + } + if (tokensBuilder_ == null) { + tokens_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + tokensBuilder_.clear(); + } + language_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnalyzeSyntaxResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSyntaxResponse getDefaultInstanceForType() { + return com.google.cloud.language.v1.AnalyzeSyntaxResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSyntaxResponse build() { + com.google.cloud.language.v1.AnalyzeSyntaxResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSyntaxResponse buildPartial() { + com.google.cloud.language.v1.AnalyzeSyntaxResponse result = new com.google.cloud.language.v1.AnalyzeSyntaxResponse(this); + int from_bitField0_ = bitField0_; + if (sentencesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + sentences_ = java.util.Collections.unmodifiableList(sentences_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.sentences_ = sentences_; + } else { + result.sentences_ = sentencesBuilder_.build(); + } + if (tokensBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + tokens_ = java.util.Collections.unmodifiableList(tokens_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.tokens_ = tokens_; + } else { + result.tokens_ = tokensBuilder_.build(); + } + result.language_ = language_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.AnalyzeSyntaxResponse) { + return mergeFrom((com.google.cloud.language.v1.AnalyzeSyntaxResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.AnalyzeSyntaxResponse other) { + if (other == com.google.cloud.language.v1.AnalyzeSyntaxResponse.getDefaultInstance()) return this; + if (sentencesBuilder_ == null) { + if (!other.sentences_.isEmpty()) { + if (sentences_.isEmpty()) { + sentences_ = other.sentences_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSentencesIsMutable(); + sentences_.addAll(other.sentences_); + } + onChanged(); + } + } else { + if (!other.sentences_.isEmpty()) { + if (sentencesBuilder_.isEmpty()) { + sentencesBuilder_.dispose(); + sentencesBuilder_ = null; + sentences_ = other.sentences_; + bitField0_ = (bitField0_ & ~0x00000001); + sentencesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getSentencesFieldBuilder() : null; + } else { + sentencesBuilder_.addAllMessages(other.sentences_); + } + } + } + if (tokensBuilder_ == null) { + if (!other.tokens_.isEmpty()) { + if (tokens_.isEmpty()) { + tokens_ = other.tokens_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureTokensIsMutable(); + tokens_.addAll(other.tokens_); + } + onChanged(); + } + } else { + if (!other.tokens_.isEmpty()) { + if (tokensBuilder_.isEmpty()) { + tokensBuilder_.dispose(); + tokensBuilder_ = null; + tokens_ = other.tokens_; + bitField0_ = (bitField0_ & ~0x00000002); + tokensBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getTokensFieldBuilder() : null; + } else { + tokensBuilder_.addAllMessages(other.tokens_); + } + } + } + if (!other.getLanguage().isEmpty()) { + language_ = other.language_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.AnalyzeSyntaxResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.AnalyzeSyntaxResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List sentences_ = + java.util.Collections.emptyList(); + private void ensureSentencesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + sentences_ = new java.util.ArrayList(sentences_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> sentencesBuilder_; + + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public java.util.List getSentencesList() { + if (sentencesBuilder_ == null) { + return java.util.Collections.unmodifiableList(sentences_); + } else { + return sentencesBuilder_.getMessageList(); + } + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public int getSentencesCount() { + if (sentencesBuilder_ == null) { + return sentences_.size(); + } else { + return sentencesBuilder_.getCount(); + } + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence getSentences(int index) { + if (sentencesBuilder_ == null) { + return sentences_.get(index); + } else { + return sentencesBuilder_.getMessage(index); + } + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder setSentences( + int index, com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.set(index, value); + onChanged(); + } else { + sentencesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder setSentences( + int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.set(index, builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences(com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.add(value); + onChanged(); + } else { + sentencesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences( + int index, com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.add(index, value); + onChanged(); + } else { + sentencesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences( + com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.add(builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences( + int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.add(index, builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addAllSentences( + java.lang.Iterable values) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, sentences_); + onChanged(); + } else { + sentencesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder clearSentences() { + if (sentencesBuilder_ == null) { + sentences_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + sentencesBuilder_.clear(); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder removeSentences(int index) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.remove(index); + onChanged(); + } else { + sentencesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder( + int index) { + return getSentencesFieldBuilder().getBuilder(index); + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index) { + if (sentencesBuilder_ == null) { + return sentences_.get(index); } else { + return sentencesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public java.util.List + getSentencesOrBuilderList() { + if (sentencesBuilder_ != null) { + return sentencesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(sentences_); + } + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() { + return getSentencesFieldBuilder().addBuilder( + com.google.cloud.language.v1.Sentence.getDefaultInstance()); + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder( + int index) { + return getSentencesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Sentence.getDefaultInstance()); + } + /** + *
+     * Sentences in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public java.util.List + getSentencesBuilderList() { + return getSentencesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> + getSentencesFieldBuilder() { + if (sentencesBuilder_ == null) { + sentencesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder>( + sentences_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + sentences_ = null; + } + return sentencesBuilder_; + } + + private java.util.List tokens_ = + java.util.Collections.emptyList(); + private void ensureTokensIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + tokens_ = new java.util.ArrayList(tokens_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Token, com.google.cloud.language.v1.Token.Builder, com.google.cloud.language.v1.TokenOrBuilder> tokensBuilder_; + + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public java.util.List getTokensList() { + if (tokensBuilder_ == null) { + return java.util.Collections.unmodifiableList(tokens_); + } else { + return tokensBuilder_.getMessageList(); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public int getTokensCount() { + if (tokensBuilder_ == null) { + return tokens_.size(); + } else { + return tokensBuilder_.getCount(); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token getTokens(int index) { + if (tokensBuilder_ == null) { + return tokens_.get(index); + } else { + return tokensBuilder_.getMessage(index); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder setTokens( + int index, com.google.cloud.language.v1.Token value) { + if (tokensBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokensIsMutable(); + tokens_.set(index, value); + onChanged(); + } else { + tokensBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder setTokens( + int index, com.google.cloud.language.v1.Token.Builder builderForValue) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.set(index, builderForValue.build()); + onChanged(); + } else { + tokensBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens(com.google.cloud.language.v1.Token value) { + if (tokensBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokensIsMutable(); + tokens_.add(value); + onChanged(); + } else { + tokensBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens( + int index, com.google.cloud.language.v1.Token value) { + if (tokensBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokensIsMutable(); + tokens_.add(index, value); + onChanged(); + } else { + tokensBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens( + com.google.cloud.language.v1.Token.Builder builderForValue) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.add(builderForValue.build()); + onChanged(); + } else { + tokensBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens( + int index, com.google.cloud.language.v1.Token.Builder builderForValue) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.add(index, builderForValue.build()); + onChanged(); + } else { + tokensBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addAllTokens( + java.lang.Iterable values) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, tokens_); + onChanged(); + } else { + tokensBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder clearTokens() { + if (tokensBuilder_ == null) { + tokens_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + tokensBuilder_.clear(); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder removeTokens(int index) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.remove(index); + onChanged(); + } else { + tokensBuilder_.remove(index); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token.Builder getTokensBuilder( + int index) { + return getTokensFieldBuilder().getBuilder(index); + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder( + int index) { + if (tokensBuilder_ == null) { + return tokens_.get(index); } else { + return tokensBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public java.util.List + getTokensOrBuilderList() { + if (tokensBuilder_ != null) { + return tokensBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tokens_); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token.Builder addTokensBuilder() { + return getTokensFieldBuilder().addBuilder( + com.google.cloud.language.v1.Token.getDefaultInstance()); + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token.Builder addTokensBuilder( + int index) { + return getTokensFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Token.getDefaultInstance()); + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public java.util.List + getTokensBuilderList() { + return getTokensFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Token, com.google.cloud.language.v1.Token.Builder, com.google.cloud.language.v1.TokenOrBuilder> + getTokensFieldBuilder() { + if (tokensBuilder_ == null) { + tokensBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Token, com.google.cloud.language.v1.Token.Builder, com.google.cloud.language.v1.TokenOrBuilder>( + tokens_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + tokens_ = null; + } + return tokensBuilder_; + } + + private java.lang.Object language_ = ""; + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 3; + * @return The language. + */ + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 3; + * @return The bytes for language. + */ + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 3; + * @param value The language to set. + * @return This builder for chaining. + */ + public Builder setLanguage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + language_ = value; + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 3; + * @return This builder for chaining. + */ + public Builder clearLanguage() { + + language_ = getDefaultInstance().getLanguage(); + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 3; + * @param value The bytes for language to set. + * @return This builder for chaining. + */ + public Builder setLanguageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + language_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnalyzeSyntaxResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnalyzeSyntaxResponse) + private static final com.google.cloud.language.v1.AnalyzeSyntaxResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnalyzeSyntaxResponse(); + } + + public static com.google.cloud.language.v1.AnalyzeSyntaxResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnalyzeSyntaxResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AnalyzeSyntaxResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnalyzeSyntaxResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java new file mode 100644 index 000000000000..893f173bb34f --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnalyzeSyntaxResponseOrBuilder.java @@ -0,0 +1,121 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnalyzeSyntaxResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnalyzeSyntaxResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + java.util.List + getSentencesList(); + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + com.google.cloud.language.v1.Sentence getSentences(int index); + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + int getSentencesCount(); + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + java.util.List + getSentencesOrBuilderList(); + /** + *
+   * Sentences in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index); + + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + java.util.List + getTokensList(); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + com.google.cloud.language.v1.Token getTokens(int index); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + int getTokensCount(); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + java.util.List + getTokensOrBuilderList(); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder( + int index); + + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 3; + * @return The language. + */ + java.lang.String getLanguage(); + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 3; + * @return The bytes for language. + */ + com.google.protobuf.ByteString + getLanguageBytes(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java new file mode 100644 index 000000000000..5ccafbd548e8 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequest.java @@ -0,0 +1,2190 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The request message for the text annotation API, which can perform multiple
+ * analysis types (sentiment, entities, and syntax) in one call.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnnotateTextRequest} + */ +public final class AnnotateTextRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnnotateTextRequest) + AnnotateTextRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnnotateTextRequest.newBuilder() to construct. + private AnnotateTextRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnnotateTextRequest() { + encodingType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnnotateTextRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnnotateTextRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.Document.Builder subBuilder = null; + if (document_ != null) { + subBuilder = document_.toBuilder(); + } + document_ = input.readMessage(com.google.cloud.language.v1.Document.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(document_); + document_ = subBuilder.buildPartial(); + } + + break; + } + case 18: { + com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder subBuilder = null; + if (features_ != null) { + subBuilder = features_.toBuilder(); + } + features_ = input.readMessage(com.google.cloud.language.v1.AnnotateTextRequest.Features.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(features_); + features_ = subBuilder.buildPartial(); + } + + break; + } + case 24: { + int rawValue = input.readEnum(); + + encodingType_ = rawValue; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnnotateTextRequest.class, com.google.cloud.language.v1.AnnotateTextRequest.Builder.class); + } + + public interface FeaturesOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnnotateTextRequest.Features) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * Extract syntax information.
+     * 
+ * + * bool extract_syntax = 1; + * @return The extractSyntax. + */ + boolean getExtractSyntax(); + + /** + *
+     * Extract entities.
+     * 
+ * + * bool extract_entities = 2; + * @return The extractEntities. + */ + boolean getExtractEntities(); + + /** + *
+     * Extract document-level sentiment.
+     * 
+ * + * bool extract_document_sentiment = 3; + * @return The extractDocumentSentiment. + */ + boolean getExtractDocumentSentiment(); + + /** + *
+     * Extract entities and their associated sentiment.
+     * 
+ * + * bool extract_entity_sentiment = 4; + * @return The extractEntitySentiment. + */ + boolean getExtractEntitySentiment(); + + /** + *
+     * Classify the full document into categories.
+     * 
+ * + * bool classify_text = 6; + * @return The classifyText. + */ + boolean getClassifyText(); + + /** + *
+     * The model options to use for classification. Defaults to v1 options
+     * if not specified. Only used if `classify_text` is set to true.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @return Whether the classificationModelOptions field is set. + */ + boolean hasClassificationModelOptions(); + /** + *
+     * The model options to use for classification. Defaults to v1 options
+     * if not specified. Only used if `classify_text` is set to true.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @return The classificationModelOptions. + */ + com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions(); + /** + *
+     * The model options to use for classification. Defaults to v1 options
+     * if not specified. Only used if `classify_text` is set to true.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder getClassificationModelOptionsOrBuilder(); + } + /** + *
+   * All available features for sentiment, syntax, and semantic analysis.
+   * Setting each one to true will enable that specific analysis for the input.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnnotateTextRequest.Features} + */ + public static final class Features extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnnotateTextRequest.Features) + FeaturesOrBuilder { + private static final long serialVersionUID = 0L; + // Use Features.newBuilder() to construct. + private Features(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Features() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new Features(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Features( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + extractSyntax_ = input.readBool(); + break; + } + case 16: { + + extractEntities_ = input.readBool(); + break; + } + case 24: { + + extractDocumentSentiment_ = input.readBool(); + break; + } + case 32: { + + extractEntitySentiment_ = input.readBool(); + break; + } + case 48: { + + classifyText_ = input.readBool(); + break; + } + case 82: { + com.google.cloud.language.v1.ClassificationModelOptions.Builder subBuilder = null; + if (classificationModelOptions_ != null) { + subBuilder = classificationModelOptions_.toBuilder(); + } + classificationModelOptions_ = input.readMessage(com.google.cloud.language.v1.ClassificationModelOptions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(classificationModelOptions_); + classificationModelOptions_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnnotateTextRequest.Features.class, com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder.class); + } + + public static final int EXTRACT_SYNTAX_FIELD_NUMBER = 1; + private boolean extractSyntax_; + /** + *
+     * Extract syntax information.
+     * 
+ * + * bool extract_syntax = 1; + * @return The extractSyntax. + */ + @java.lang.Override + public boolean getExtractSyntax() { + return extractSyntax_; + } + + public static final int EXTRACT_ENTITIES_FIELD_NUMBER = 2; + private boolean extractEntities_; + /** + *
+     * Extract entities.
+     * 
+ * + * bool extract_entities = 2; + * @return The extractEntities. + */ + @java.lang.Override + public boolean getExtractEntities() { + return extractEntities_; + } + + public static final int EXTRACT_DOCUMENT_SENTIMENT_FIELD_NUMBER = 3; + private boolean extractDocumentSentiment_; + /** + *
+     * Extract document-level sentiment.
+     * 
+ * + * bool extract_document_sentiment = 3; + * @return The extractDocumentSentiment. + */ + @java.lang.Override + public boolean getExtractDocumentSentiment() { + return extractDocumentSentiment_; + } + + public static final int EXTRACT_ENTITY_SENTIMENT_FIELD_NUMBER = 4; + private boolean extractEntitySentiment_; + /** + *
+     * Extract entities and their associated sentiment.
+     * 
+ * + * bool extract_entity_sentiment = 4; + * @return The extractEntitySentiment. + */ + @java.lang.Override + public boolean getExtractEntitySentiment() { + return extractEntitySentiment_; + } + + public static final int CLASSIFY_TEXT_FIELD_NUMBER = 6; + private boolean classifyText_; + /** + *
+     * Classify the full document into categories.
+     * 
+ * + * bool classify_text = 6; + * @return The classifyText. + */ + @java.lang.Override + public boolean getClassifyText() { + return classifyText_; + } + + public static final int CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER = 10; + private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; + /** + *
+     * The model options to use for classification. Defaults to v1 options
+     * if not specified. Only used if `classify_text` is set to true.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @return Whether the classificationModelOptions field is set. + */ + @java.lang.Override + public boolean hasClassificationModelOptions() { + return classificationModelOptions_ != null; + } + /** + *
+     * The model options to use for classification. Defaults to v1 options
+     * if not specified. Only used if `classify_text` is set to true.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @return The classificationModelOptions. + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions() { + return classificationModelOptions_ == null ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() : classificationModelOptions_; + } + /** + *
+     * The model options to use for classification. Defaults to v1 options
+     * if not specified. Only used if `classify_text` is set to true.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder getClassificationModelOptionsOrBuilder() { + return getClassificationModelOptions(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (extractSyntax_ != false) { + output.writeBool(1, extractSyntax_); + } + if (extractEntities_ != false) { + output.writeBool(2, extractEntities_); + } + if (extractDocumentSentiment_ != false) { + output.writeBool(3, extractDocumentSentiment_); + } + if (extractEntitySentiment_ != false) { + output.writeBool(4, extractEntitySentiment_); + } + if (classifyText_ != false) { + output.writeBool(6, classifyText_); + } + if (classificationModelOptions_ != null) { + output.writeMessage(10, getClassificationModelOptions()); + } + 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_); + } + if (classificationModelOptions_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(10, getClassificationModelOptions()); + } + 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 (hasClassificationModelOptions() != other.hasClassificationModelOptions()) return false; + if (hasClassificationModelOptions()) { + if (!getClassificationModelOptions() + .equals(other.getClassificationModelOptions())) 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()); + if (hasClassificationModelOptions()) { + hash = (37 * hash) + CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getClassificationModelOptions().hashCode(); + } + 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; + + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptions_ = null; + } else { + classificationModelOptions_ = null; + classificationModelOptionsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextRequest_Features_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextRequest.Features getDefaultInstanceForType() { + return com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextRequest.Features build() { + com.google.cloud.language.v1.AnnotateTextRequest.Features result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextRequest.Features buildPartial() { + com.google.cloud.language.v1.AnnotateTextRequest.Features result = new com.google.cloud.language.v1.AnnotateTextRequest.Features(this); + result.extractSyntax_ = extractSyntax_; + result.extractEntities_ = extractEntities_; + result.extractDocumentSentiment_ = extractDocumentSentiment_; + result.extractEntitySentiment_ = extractEntitySentiment_; + result.classifyText_ = classifyText_; + if (classificationModelOptionsBuilder_ == null) { + result.classificationModelOptions_ = classificationModelOptions_; + } else { + result.classificationModelOptions_ = classificationModelOptionsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.AnnotateTextRequest.Features) { + return mergeFrom((com.google.cloud.language.v1.AnnotateTextRequest.Features)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextRequest.Features other) { + if (other == com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance()) return this; + if (other.getExtractSyntax() != false) { + setExtractSyntax(other.getExtractSyntax()); + } + if (other.getExtractEntities() != false) { + setExtractEntities(other.getExtractEntities()); + } + if (other.getExtractDocumentSentiment() != false) { + setExtractDocumentSentiment(other.getExtractDocumentSentiment()); + } + if (other.getExtractEntitySentiment() != false) { + setExtractEntitySentiment(other.getExtractEntitySentiment()); + } + if (other.getClassifyText() != false) { + setClassifyText(other.getClassifyText()); + } + if (other.hasClassificationModelOptions()) { + mergeClassificationModelOptions(other.getClassificationModelOptions()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.AnnotateTextRequest.Features parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.AnnotateTextRequest.Features) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean extractSyntax_ ; + /** + *
+       * Extract syntax information.
+       * 
+ * + * bool extract_syntax = 1; + * @return The extractSyntax. + */ + @java.lang.Override + public boolean getExtractSyntax() { + return extractSyntax_; + } + /** + *
+       * Extract syntax information.
+       * 
+ * + * bool extract_syntax = 1; + * @param value The extractSyntax to set. + * @return This builder for chaining. + */ + public Builder setExtractSyntax(boolean value) { + + extractSyntax_ = value; + onChanged(); + return this; + } + /** + *
+       * Extract syntax information.
+       * 
+ * + * bool extract_syntax = 1; + * @return This builder for chaining. + */ + public Builder clearExtractSyntax() { + + extractSyntax_ = false; + onChanged(); + return this; + } + + private boolean extractEntities_ ; + /** + *
+       * Extract entities.
+       * 
+ * + * bool extract_entities = 2; + * @return The extractEntities. + */ + @java.lang.Override + public boolean getExtractEntities() { + return extractEntities_; + } + /** + *
+       * Extract entities.
+       * 
+ * + * bool extract_entities = 2; + * @param value The extractEntities to set. + * @return This builder for chaining. + */ + public Builder setExtractEntities(boolean value) { + + extractEntities_ = value; + onChanged(); + return this; + } + /** + *
+       * Extract entities.
+       * 
+ * + * bool extract_entities = 2; + * @return This builder for chaining. + */ + public Builder clearExtractEntities() { + + extractEntities_ = false; + onChanged(); + return this; + } + + private boolean extractDocumentSentiment_ ; + /** + *
+       * Extract document-level sentiment.
+       * 
+ * + * bool extract_document_sentiment = 3; + * @return The extractDocumentSentiment. + */ + @java.lang.Override + public boolean getExtractDocumentSentiment() { + return extractDocumentSentiment_; + } + /** + *
+       * Extract document-level sentiment.
+       * 
+ * + * bool extract_document_sentiment = 3; + * @param value The extractDocumentSentiment to set. + * @return This builder for chaining. + */ + public Builder setExtractDocumentSentiment(boolean value) { + + extractDocumentSentiment_ = value; + onChanged(); + return this; + } + /** + *
+       * Extract document-level sentiment.
+       * 
+ * + * bool extract_document_sentiment = 3; + * @return This builder for chaining. + */ + public Builder clearExtractDocumentSentiment() { + + extractDocumentSentiment_ = false; + onChanged(); + return this; + } + + private boolean extractEntitySentiment_ ; + /** + *
+       * Extract entities and their associated sentiment.
+       * 
+ * + * bool extract_entity_sentiment = 4; + * @return The extractEntitySentiment. + */ + @java.lang.Override + public boolean getExtractEntitySentiment() { + return extractEntitySentiment_; + } + /** + *
+       * Extract entities and their associated sentiment.
+       * 
+ * + * bool extract_entity_sentiment = 4; + * @param value The extractEntitySentiment to set. + * @return This builder for chaining. + */ + public Builder setExtractEntitySentiment(boolean value) { + + extractEntitySentiment_ = value; + onChanged(); + return this; + } + /** + *
+       * Extract entities and their associated sentiment.
+       * 
+ * + * bool extract_entity_sentiment = 4; + * @return This builder for chaining. + */ + public Builder clearExtractEntitySentiment() { + + extractEntitySentiment_ = false; + onChanged(); + return this; + } + + private boolean classifyText_ ; + /** + *
+       * Classify the full document into categories.
+       * 
+ * + * bool classify_text = 6; + * @return The classifyText. + */ + @java.lang.Override + public boolean getClassifyText() { + return classifyText_; + } + /** + *
+       * Classify the full document into categories.
+       * 
+ * + * bool classify_text = 6; + * @param value The classifyText to set. + * @return This builder for chaining. + */ + public Builder setClassifyText(boolean value) { + + classifyText_ = value; + onChanged(); + return this; + } + /** + *
+       * Classify the full document into categories.
+       * 
+ * + * bool classify_text = 6; + * @return This builder for chaining. + */ + public Builder clearClassifyText() { + + classifyText_ = false; + onChanged(); + return this; + } + + private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions, com.google.cloud.language.v1.ClassificationModelOptions.Builder, com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> classificationModelOptionsBuilder_; + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @return Whether the classificationModelOptions field is set. + */ + public boolean hasClassificationModelOptions() { + return classificationModelOptionsBuilder_ != null || classificationModelOptions_ != null; + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + * @return The classificationModelOptions. + */ + public com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions() { + if (classificationModelOptionsBuilder_ == null) { + return classificationModelOptions_ == null ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() : classificationModelOptions_; + } else { + return classificationModelOptionsBuilder_.getMessage(); + } + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + public Builder setClassificationModelOptions(com.google.cloud.language.v1.ClassificationModelOptions value) { + if (classificationModelOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + classificationModelOptions_ = value; + onChanged(); + } else { + classificationModelOptionsBuilder_.setMessage(value); + } + + return this; + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + public Builder setClassificationModelOptions( + com.google.cloud.language.v1.ClassificationModelOptions.Builder builderForValue) { + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptions_ = builderForValue.build(); + onChanged(); + } else { + classificationModelOptionsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + public Builder mergeClassificationModelOptions(com.google.cloud.language.v1.ClassificationModelOptions value) { + if (classificationModelOptionsBuilder_ == null) { + if (classificationModelOptions_ != null) { + classificationModelOptions_ = + com.google.cloud.language.v1.ClassificationModelOptions.newBuilder(classificationModelOptions_).mergeFrom(value).buildPartial(); + } else { + classificationModelOptions_ = value; + } + onChanged(); + } else { + classificationModelOptionsBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + public Builder clearClassificationModelOptions() { + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptions_ = null; + onChanged(); + } else { + classificationModelOptions_ = null; + classificationModelOptionsBuilder_ = null; + } + + return this; + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + public com.google.cloud.language.v1.ClassificationModelOptions.Builder getClassificationModelOptionsBuilder() { + + onChanged(); + return getClassificationModelOptionsFieldBuilder().getBuilder(); + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder getClassificationModelOptionsOrBuilder() { + if (classificationModelOptionsBuilder_ != null) { + return classificationModelOptionsBuilder_.getMessageOrBuilder(); + } else { + return classificationModelOptions_ == null ? + com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() : classificationModelOptions_; + } + } + /** + *
+       * The model options to use for classification. Defaults to v1 options
+       * if not specified. Only used if `classify_text` is set to true.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 10; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions, com.google.cloud.language.v1.ClassificationModelOptions.Builder, com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> + getClassificationModelOptionsFieldBuilder() { + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions, com.google.cloud.language.v1.ClassificationModelOptions.Builder, com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder>( + getClassificationModelOptions(), + getParentForChildren(), + isClean()); + classificationModelOptions_ = null; + } + return classificationModelOptionsBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnnotateTextRequest.Features) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnnotateTextRequest.Features) + private static final com.google.cloud.language.v1.AnnotateTextRequest.Features DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnnotateTextRequest.Features(); + } + + public static com.google.cloud.language.v1.AnnotateTextRequest.Features getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Features parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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_; + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + @java.lang.Override + public boolean hasDocument() { + return document_ != null; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + @java.lang.Override + public com.google.cloud.language.v1.Document getDocument() { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + return getDocument(); + } + + public static final int FEATURES_FIELD_NUMBER = 2; + private com.google.cloud.language.v1.AnnotateTextRequest.Features features_; + /** + *
+   * Required. The enabled features.
+   * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the features field is set. + */ + @java.lang.Override + public boolean hasFeatures() { + return features_ != null; + } + /** + *
+   * Required. The enabled features.
+   * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The features. + */ + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures() { + return features_ == null ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; + } + /** + *
+   * Required. The enabled features.
+   * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder getFeaturesOrBuilder() { + return getFeatures(); + } + + public static final int ENCODING_TYPE_FIELD_NUMBER = 3; + private int encodingType_; + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return The encodingType. + */ + @java.lang.Override public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (document_ != null) { + output.writeMessage(1, getDocument()); + } + if (features_ != null) { + output.writeMessage(2, getFeatures()); + } + if (encodingType_ != com.google.cloud.language.v1.EncodingType.NONE.getNumber()) { + output.writeEnum(3, encodingType_); + } + 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_; + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + public boolean hasDocument() { + return documentBuilder_ != null || document_ != null; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + public com.google.cloud.language.v1.Document getDocument() { + if (documentBuilder_ == null) { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } else { + return documentBuilder_.getMessage(); + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + document_ = value; + onChanged(); + } else { + documentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument( + com.google.cloud.language.v1.Document.Builder builderForValue) { + if (documentBuilder_ == null) { + document_ = builderForValue.build(); + onChanged(); + } else { + documentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (document_ != null) { + document_ = + com.google.cloud.language.v1.Document.newBuilder(document_).mergeFrom(value).buildPartial(); + } else { + document_ = value; + } + onChanged(); + } else { + documentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearDocument() { + if (documentBuilder_ == null) { + document_ = null; + onChanged(); + } else { + document_ = null; + documentBuilder_ = null; + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { + + onChanged(); + return getDocumentFieldBuilder().getBuilder(); + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + if (documentBuilder_ != null) { + return documentBuilder_.getMessageOrBuilder(); + } else { + return document_ == null ? + com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder> + getDocumentFieldBuilder() { + if (documentBuilder_ == null) { + documentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder>( + getDocument(), + getParentForChildren(), + isClean()); + document_ = null; + } + return documentBuilder_; + } + + private com.google.cloud.language.v1.AnnotateTextRequest.Features features_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.AnnotateTextRequest.Features, com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder, com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder> featuresBuilder_; + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the features field is set. + */ + public boolean hasFeatures() { + return featuresBuilder_ != null || features_ != null; + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The features. + */ + public com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures() { + if (featuresBuilder_ == null) { + return features_ == null ? com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; + } else { + return featuresBuilder_.getMessage(); + } + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setFeatures(com.google.cloud.language.v1.AnnotateTextRequest.Features value) { + if (featuresBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + features_ = value; + onChanged(); + } else { + featuresBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setFeatures( + com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder builderForValue) { + if (featuresBuilder_ == null) { + features_ = builderForValue.build(); + onChanged(); + } else { + featuresBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeFeatures(com.google.cloud.language.v1.AnnotateTextRequest.Features value) { + if (featuresBuilder_ == null) { + if (features_ != null) { + features_ = + com.google.cloud.language.v1.AnnotateTextRequest.Features.newBuilder(features_).mergeFrom(value).buildPartial(); + } else { + features_ = value; + } + onChanged(); + } else { + featuresBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearFeatures() { + if (featuresBuilder_ == null) { + features_ = null; + onChanged(); + } else { + features_ = null; + featuresBuilder_ = null; + } + + return this; + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder getFeaturesBuilder() { + + onChanged(); + return getFeaturesFieldBuilder().getBuilder(); + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder getFeaturesOrBuilder() { + if (featuresBuilder_ != null) { + return featuresBuilder_.getMessageOrBuilder(); + } else { + return features_ == null ? + com.google.cloud.language.v1.AnnotateTextRequest.Features.getDefaultInstance() : features_; + } + } + /** + *
+     * Required. The enabled features.
+     * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.AnnotateTextRequest.Features, com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder, com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder> + getFeaturesFieldBuilder() { + if (featuresBuilder_ == null) { + featuresBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.AnnotateTextRequest.Features, com.google.cloud.language.v1.AnnotateTextRequest.Features.Builder, com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder>( + getFeatures(), + getParentForChildren(), + isClean()); + features_ = null; + } + return featuresBuilder_; + } + + private int encodingType_ = 0; + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return The enum numeric value on the wire for encodingType. + */ + @java.lang.Override public int getEncodingTypeValue() { + return encodingType_; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @param value The enum numeric value on the wire for encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingTypeValue(int value) { + + encodingType_ = value; + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return The encodingType. + */ + @java.lang.Override + public com.google.cloud.language.v1.EncodingType getEncodingType() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.EncodingType result = com.google.cloud.language.v1.EncodingType.valueOf(encodingType_); + return result == null ? com.google.cloud.language.v1.EncodingType.UNRECOGNIZED : result; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @param value The encodingType to set. + * @return This builder for chaining. + */ + public Builder setEncodingType(com.google.cloud.language.v1.EncodingType value) { + if (value == null) { + throw new NullPointerException(); + } + + encodingType_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The encoding type used by the API to calculate offsets.
+     * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return This builder for chaining. + */ + public Builder clearEncodingType() { + + encodingType_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnnotateTextRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnnotateTextRequest) + private static final com.google.cloud.language.v1.AnnotateTextRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnnotateTextRequest(); + } + + public static com.google.cloud.language.v1.AnnotateTextRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnnotateTextRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java new file mode 100644 index 000000000000..65e7a695d9e2 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextRequestOrBuilder.java @@ -0,0 +1,82 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnnotateTextRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnnotateTextRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + boolean hasDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + com.google.cloud.language.v1.Document getDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); + + /** + *
+   * Required. The enabled features.
+   * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the features field is set. + */ + boolean hasFeatures(); + /** + *
+   * Required. The enabled features.
+   * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The features. + */ + com.google.cloud.language.v1.AnnotateTextRequest.Features getFeatures(); + /** + *
+   * Required. The enabled features.
+   * 
+ * + * .google.cloud.language.v1.AnnotateTextRequest.Features features = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.language.v1.AnnotateTextRequest.FeaturesOrBuilder getFeaturesOrBuilder(); + + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return The enum numeric value on the wire for encodingType. + */ + int getEncodingTypeValue(); + /** + *
+   * The encoding type used by the API to calculate offsets.
+   * 
+ * + * .google.cloud.language.v1.EncodingType encoding_type = 3; + * @return The encodingType. + */ + com.google.cloud.language.v1.EncodingType getEncodingType(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java new file mode 100644 index 000000000000..793eb3831015 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponse.java @@ -0,0 +1,2735 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The text annotations response message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnnotateTextResponse} + */ +public final class AnnotateTextResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnnotateTextResponse) + AnnotateTextResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use AnnotateTextResponse.newBuilder() to construct. + private AnnotateTextResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AnnotateTextResponse() { + sentences_ = java.util.Collections.emptyList(); + tokens_ = java.util.Collections.emptyList(); + entities_ = java.util.Collections.emptyList(); + language_ = ""; + categories_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AnnotateTextResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AnnotateTextResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + sentences_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + sentences_.add( + input.readMessage(com.google.cloud.language.v1.Sentence.parser(), extensionRegistry)); + break; + } + case 18: { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + tokens_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + tokens_.add( + input.readMessage(com.google.cloud.language.v1.Token.parser(), extensionRegistry)); + break; + } + case 26: { + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + entities_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000004; + } + entities_.add( + input.readMessage(com.google.cloud.language.v1.Entity.parser(), extensionRegistry)); + break; + } + case 34: { + com.google.cloud.language.v1.Sentiment.Builder subBuilder = null; + if (documentSentiment_ != null) { + subBuilder = documentSentiment_.toBuilder(); + } + documentSentiment_ = input.readMessage(com.google.cloud.language.v1.Sentiment.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(documentSentiment_); + documentSentiment_ = subBuilder.buildPartial(); + } + + break; + } + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + + language_ = s; + break; + } + case 50: { + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + categories_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000008; + } + categories_.add( + input.readMessage(com.google.cloud.language.v1.ClassificationCategory.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + sentences_ = java.util.Collections.unmodifiableList(sentences_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + tokens_ = java.util.Collections.unmodifiableList(tokens_); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + categories_ = java.util.Collections.unmodifiableList(categories_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnnotateTextResponse.class, com.google.cloud.language.v1.AnnotateTextResponse.Builder.class); + } + + public static final int SENTENCES_FIELD_NUMBER = 1; + private java.util.List sentences_; + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public java.util.List getSentencesList() { + return sentences_; + } + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public java.util.List + getSentencesOrBuilderList() { + return sentences_; + } + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public int getSentencesCount() { + return sentences_.size(); + } + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.Sentence getSentences(int index) { + return sentences_.get(index); + } + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index) { + return sentences_.get(index); + } + + public static final int TOKENS_FIELD_NUMBER = 2; + private java.util.List tokens_; + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public java.util.List getTokensList() { + return tokens_; + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public java.util.List + getTokensOrBuilderList() { + return tokens_; + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public int getTokensCount() { + return tokens_.size(); + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public com.google.cloud.language.v1.Token getTokens(int index) { + return tokens_.get(index); + } + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + @java.lang.Override + public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder( + int index) { + return tokens_.get(index); + } + + public static final int ENTITIES_FIELD_NUMBER = 3; + private java.util.List entities_; + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + @java.lang.Override + public java.util.List getEntitiesList() { + return entities_; + } + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + @java.lang.Override + public java.util.List + getEntitiesOrBuilderList() { + return entities_; + } + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + @java.lang.Override + public int getEntitiesCount() { + return entities_.size(); + } + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + @java.lang.Override + public com.google.cloud.language.v1.Entity getEntities(int index) { + return entities_.get(index); + } + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + @java.lang.Override + public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index) { + return entities_.get(index); + } + + public static final int DOCUMENT_SENTIMENT_FIELD_NUMBER = 4; + private com.google.cloud.language.v1.Sentiment documentSentiment_; + /** + *
+   * The overall sentiment for the document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @return Whether the documentSentiment field is set. + */ + @java.lang.Override + public boolean hasDocumentSentiment() { + return documentSentiment_ != null; + } + /** + *
+   * The overall sentiment for the document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @return The documentSentiment. + */ + @java.lang.Override + public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { + return documentSentiment_ == null ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_; + } + /** + *
+   * The overall sentiment for the document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + @java.lang.Override + public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { + return getDocumentSentiment(); + } + + public static final int LANGUAGE_FIELD_NUMBER = 5; + private volatile java.lang.Object language_; + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 5; + * @return The language. + */ + @java.lang.Override + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } + } + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 5; + * @return The bytes for language. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CATEGORIES_FIELD_NUMBER = 6; + private java.util.List categories_; + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + @java.lang.Override + public java.util.List getCategoriesList() { + return categories_; + } + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + @java.lang.Override + public java.util.List + getCategoriesOrBuilderList() { + return categories_; + } + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + @java.lang.Override + public int getCategoriesCount() { + return categories_.size(); + } + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { + return categories_.get(index); + } + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( + int index) { + return categories_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < sentences_.size(); i++) { + output.writeMessage(1, sentences_.get(i)); + } + for (int i = 0; i < tokens_.size(); i++) { + output.writeMessage(2, tokens_.get(i)); + } + for (int i = 0; i < entities_.size(); i++) { + output.writeMessage(3, entities_.get(i)); + } + if (documentSentiment_ != null) { + output.writeMessage(4, getDocumentSentiment()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, language_); + } + for (int i = 0; i < categories_.size(); i++) { + output.writeMessage(6, categories_.get(i)); + } + 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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, language_); + } + for (int i = 0; i < categories_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, categories_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextResponse)) { + return super.equals(obj); + } + com.google.cloud.language.v1.AnnotateTextResponse other = (com.google.cloud.language.v1.AnnotateTextResponse) obj; + + if (!getSentencesList() + .equals(other.getSentencesList())) return false; + if (!getTokensList() + .equals(other.getTokensList())) return false; + if (!getEntitiesList() + .equals(other.getEntitiesList())) return false; + if (hasDocumentSentiment() != other.hasDocumentSentiment()) return false; + if (hasDocumentSentiment()) { + if (!getDocumentSentiment() + .equals(other.getDocumentSentiment())) return false; + } + if (!getLanguage() + .equals(other.getLanguage())) return false; + if (!getCategoriesList() + .equals(other.getCategoriesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSentencesCount() > 0) { + hash = (37 * hash) + SENTENCES_FIELD_NUMBER; + hash = (53 * hash) + getSentencesList().hashCode(); + } + if (getTokensCount() > 0) { + hash = (37 * hash) + TOKENS_FIELD_NUMBER; + hash = (53 * hash) + getTokensList().hashCode(); + } + if (getEntitiesCount() > 0) { + hash = (37 * hash) + ENTITIES_FIELD_NUMBER; + hash = (53 * hash) + getEntitiesList().hashCode(); + } + if (hasDocumentSentiment()) { + hash = (37 * hash) + DOCUMENT_SENTIMENT_FIELD_NUMBER; + hash = (53 * hash) + getDocumentSentiment().hashCode(); + } + hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; + hash = (53 * hash) + getLanguage().hashCode(); + if (getCategoriesCount() > 0) { + hash = (37 * hash) + CATEGORIES_FIELD_NUMBER; + hash = (53 * hash) + getCategoriesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.AnnotateTextResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The text annotations response message.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.AnnotateTextResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnnotateTextResponse) + com.google.cloud.language.v1.AnnotateTextResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.AnnotateTextResponse.class, com.google.cloud.language.v1.AnnotateTextResponse.Builder.class); + } + + // Construct using com.google.cloud.language.v1.AnnotateTextResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getSentencesFieldBuilder(); + getTokensFieldBuilder(); + getEntitiesFieldBuilder(); + getCategoriesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (sentencesBuilder_ == null) { + sentences_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + sentencesBuilder_.clear(); + } + if (tokensBuilder_ == null) { + tokens_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + tokensBuilder_.clear(); + } + if (entitiesBuilder_ == null) { + entities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + } else { + entitiesBuilder_.clear(); + } + if (documentSentimentBuilder_ == null) { + documentSentiment_ = null; + } else { + documentSentiment_ = null; + documentSentimentBuilder_ = null; + } + language_ = ""; + + if (categoriesBuilder_ == null) { + categories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + } else { + categoriesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstanceForType() { + return com.google.cloud.language.v1.AnnotateTextResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextResponse build() { + com.google.cloud.language.v1.AnnotateTextResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextResponse buildPartial() { + com.google.cloud.language.v1.AnnotateTextResponse result = new com.google.cloud.language.v1.AnnotateTextResponse(this); + int from_bitField0_ = bitField0_; + if (sentencesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + sentences_ = java.util.Collections.unmodifiableList(sentences_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.sentences_ = sentences_; + } else { + result.sentences_ = sentencesBuilder_.build(); + } + if (tokensBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + tokens_ = java.util.Collections.unmodifiableList(tokens_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.tokens_ = tokens_; + } else { + result.tokens_ = tokensBuilder_.build(); + } + if (entitiesBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + entities_ = java.util.Collections.unmodifiableList(entities_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.entities_ = entities_; + } else { + result.entities_ = entitiesBuilder_.build(); + } + if (documentSentimentBuilder_ == null) { + result.documentSentiment_ = documentSentiment_; + } else { + result.documentSentiment_ = documentSentimentBuilder_.build(); + } + result.language_ = language_; + if (categoriesBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + categories_ = java.util.Collections.unmodifiableList(categories_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.categories_ = categories_; + } else { + result.categories_ = categoriesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.AnnotateTextResponse) { + return mergeFrom((com.google.cloud.language.v1.AnnotateTextResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextResponse other) { + if (other == com.google.cloud.language.v1.AnnotateTextResponse.getDefaultInstance()) return this; + if (sentencesBuilder_ == null) { + if (!other.sentences_.isEmpty()) { + if (sentences_.isEmpty()) { + sentences_ = other.sentences_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSentencesIsMutable(); + sentences_.addAll(other.sentences_); + } + onChanged(); + } + } else { + if (!other.sentences_.isEmpty()) { + if (sentencesBuilder_.isEmpty()) { + sentencesBuilder_.dispose(); + sentencesBuilder_ = null; + sentences_ = other.sentences_; + bitField0_ = (bitField0_ & ~0x00000001); + sentencesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getSentencesFieldBuilder() : null; + } else { + sentencesBuilder_.addAllMessages(other.sentences_); + } + } + } + if (tokensBuilder_ == null) { + if (!other.tokens_.isEmpty()) { + if (tokens_.isEmpty()) { + tokens_ = other.tokens_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureTokensIsMutable(); + tokens_.addAll(other.tokens_); + } + onChanged(); + } + } else { + if (!other.tokens_.isEmpty()) { + if (tokensBuilder_.isEmpty()) { + tokensBuilder_.dispose(); + tokensBuilder_ = null; + tokens_ = other.tokens_; + bitField0_ = (bitField0_ & ~0x00000002); + tokensBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getTokensFieldBuilder() : null; + } else { + tokensBuilder_.addAllMessages(other.tokens_); + } + } + } + if (entitiesBuilder_ == null) { + if (!other.entities_.isEmpty()) { + if (entities_.isEmpty()) { + entities_ = other.entities_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureEntitiesIsMutable(); + entities_.addAll(other.entities_); + } + onChanged(); + } + } else { + if (!other.entities_.isEmpty()) { + if (entitiesBuilder_.isEmpty()) { + entitiesBuilder_.dispose(); + entitiesBuilder_ = null; + entities_ = other.entities_; + bitField0_ = (bitField0_ & ~0x00000004); + entitiesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getEntitiesFieldBuilder() : null; + } else { + entitiesBuilder_.addAllMessages(other.entities_); + } + } + } + if (other.hasDocumentSentiment()) { + mergeDocumentSentiment(other.getDocumentSentiment()); + } + if (!other.getLanguage().isEmpty()) { + language_ = other.language_; + onChanged(); + } + if (categoriesBuilder_ == null) { + if (!other.categories_.isEmpty()) { + if (categories_.isEmpty()) { + categories_ = other.categories_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureCategoriesIsMutable(); + categories_.addAll(other.categories_); + } + onChanged(); + } + } else { + if (!other.categories_.isEmpty()) { + if (categoriesBuilder_.isEmpty()) { + categoriesBuilder_.dispose(); + categoriesBuilder_ = null; + categories_ = other.categories_; + bitField0_ = (bitField0_ & ~0x00000008); + categoriesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getCategoriesFieldBuilder() : null; + } else { + categoriesBuilder_.addAllMessages(other.categories_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.AnnotateTextResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.AnnotateTextResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List sentences_ = + java.util.Collections.emptyList(); + private void ensureSentencesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + sentences_ = new java.util.ArrayList(sentences_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> sentencesBuilder_; + + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public java.util.List getSentencesList() { + if (sentencesBuilder_ == null) { + return java.util.Collections.unmodifiableList(sentences_); + } else { + return sentencesBuilder_.getMessageList(); + } + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public int getSentencesCount() { + if (sentencesBuilder_ == null) { + return sentences_.size(); + } else { + return sentencesBuilder_.getCount(); + } + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence getSentences(int index) { + if (sentencesBuilder_ == null) { + return sentences_.get(index); + } else { + return sentencesBuilder_.getMessage(index); + } + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder setSentences( + int index, com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.set(index, value); + onChanged(); + } else { + sentencesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder setSentences( + int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.set(index, builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences(com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.add(value); + onChanged(); + } else { + sentencesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences( + int index, com.google.cloud.language.v1.Sentence value) { + if (sentencesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSentencesIsMutable(); + sentences_.add(index, value); + onChanged(); + } else { + sentencesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences( + com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.add(builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addSentences( + int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.add(index, builderForValue.build()); + onChanged(); + } else { + sentencesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder addAllSentences( + java.lang.Iterable values) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, sentences_); + onChanged(); + } else { + sentencesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder clearSentences() { + if (sentencesBuilder_ == null) { + sentences_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + sentencesBuilder_.clear(); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public Builder removeSentences(int index) { + if (sentencesBuilder_ == null) { + ensureSentencesIsMutable(); + sentences_.remove(index); + onChanged(); + } else { + sentencesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder( + int index) { + return getSentencesFieldBuilder().getBuilder(index); + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index) { + if (sentencesBuilder_ == null) { + return sentences_.get(index); } else { + return sentencesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public java.util.List + getSentencesOrBuilderList() { + if (sentencesBuilder_ != null) { + return sentencesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(sentences_); + } + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() { + return getSentencesFieldBuilder().addBuilder( + com.google.cloud.language.v1.Sentence.getDefaultInstance()); + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder( + int index) { + return getSentencesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Sentence.getDefaultInstance()); + } + /** + *
+     * Sentences in the input document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + public java.util.List + getSentencesBuilderList() { + return getSentencesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder> + getSentencesFieldBuilder() { + if (sentencesBuilder_ == null) { + sentencesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Sentence, com.google.cloud.language.v1.Sentence.Builder, com.google.cloud.language.v1.SentenceOrBuilder>( + sentences_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + sentences_ = null; + } + return sentencesBuilder_; + } + + private java.util.List tokens_ = + java.util.Collections.emptyList(); + private void ensureTokensIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + tokens_ = new java.util.ArrayList(tokens_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Token, com.google.cloud.language.v1.Token.Builder, com.google.cloud.language.v1.TokenOrBuilder> tokensBuilder_; + + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public java.util.List getTokensList() { + if (tokensBuilder_ == null) { + return java.util.Collections.unmodifiableList(tokens_); + } else { + return tokensBuilder_.getMessageList(); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public int getTokensCount() { + if (tokensBuilder_ == null) { + return tokens_.size(); + } else { + return tokensBuilder_.getCount(); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token getTokens(int index) { + if (tokensBuilder_ == null) { + return tokens_.get(index); + } else { + return tokensBuilder_.getMessage(index); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder setTokens( + int index, com.google.cloud.language.v1.Token value) { + if (tokensBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokensIsMutable(); + tokens_.set(index, value); + onChanged(); + } else { + tokensBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder setTokens( + int index, com.google.cloud.language.v1.Token.Builder builderForValue) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.set(index, builderForValue.build()); + onChanged(); + } else { + tokensBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens(com.google.cloud.language.v1.Token value) { + if (tokensBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokensIsMutable(); + tokens_.add(value); + onChanged(); + } else { + tokensBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens( + int index, com.google.cloud.language.v1.Token value) { + if (tokensBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTokensIsMutable(); + tokens_.add(index, value); + onChanged(); + } else { + tokensBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens( + com.google.cloud.language.v1.Token.Builder builderForValue) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.add(builderForValue.build()); + onChanged(); + } else { + tokensBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addTokens( + int index, com.google.cloud.language.v1.Token.Builder builderForValue) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.add(index, builderForValue.build()); + onChanged(); + } else { + tokensBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder addAllTokens( + java.lang.Iterable values) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, tokens_); + onChanged(); + } else { + tokensBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder clearTokens() { + if (tokensBuilder_ == null) { + tokens_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + tokensBuilder_.clear(); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public Builder removeTokens(int index) { + if (tokensBuilder_ == null) { + ensureTokensIsMutable(); + tokens_.remove(index); + onChanged(); + } else { + tokensBuilder_.remove(index); + } + return this; + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token.Builder getTokensBuilder( + int index) { + return getTokensFieldBuilder().getBuilder(index); + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder( + int index) { + if (tokensBuilder_ == null) { + return tokens_.get(index); } else { + return tokensBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public java.util.List + getTokensOrBuilderList() { + if (tokensBuilder_ != null) { + return tokensBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tokens_); + } + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token.Builder addTokensBuilder() { + return getTokensFieldBuilder().addBuilder( + com.google.cloud.language.v1.Token.getDefaultInstance()); + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public com.google.cloud.language.v1.Token.Builder addTokensBuilder( + int index) { + return getTokensFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Token.getDefaultInstance()); + } + /** + *
+     * Tokens, along with their syntactic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+     * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + public java.util.List + getTokensBuilderList() { + return getTokensFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Token, com.google.cloud.language.v1.Token.Builder, com.google.cloud.language.v1.TokenOrBuilder> + getTokensFieldBuilder() { + if (tokensBuilder_ == null) { + tokensBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Token, com.google.cloud.language.v1.Token.Builder, com.google.cloud.language.v1.TokenOrBuilder>( + tokens_, + ((bitField0_ & 0x00000002) != 0), + getParentForChildren(), + isClean()); + tokens_ = null; + } + return tokensBuilder_; + } + + private java.util.List entities_ = + java.util.Collections.emptyList(); + private void ensureEntitiesIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + entities_ = new java.util.ArrayList(entities_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder> entitiesBuilder_; + + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public java.util.List getEntitiesList() { + if (entitiesBuilder_ == null) { + return java.util.Collections.unmodifiableList(entities_); + } else { + return entitiesBuilder_.getMessageList(); + } + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public int getEntitiesCount() { + if (entitiesBuilder_ == null) { + return entities_.size(); + } else { + return entitiesBuilder_.getCount(); + } + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public com.google.cloud.language.v1.Entity getEntities(int index) { + if (entitiesBuilder_ == null) { + return entities_.get(index); + } else { + return entitiesBuilder_.getMessage(index); + } + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder setEntities( + int index, com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.set(index, value); + onChanged(); + } else { + entitiesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder setEntities( + int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.set(index, builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder addEntities(com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.add(value); + onChanged(); + } else { + entitiesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder addEntities( + int index, com.google.cloud.language.v1.Entity value) { + if (entitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEntitiesIsMutable(); + entities_.add(index, value); + onChanged(); + } else { + entitiesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder addEntities( + com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.add(builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder addEntities( + int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.add(index, builderForValue.build()); + onChanged(); + } else { + entitiesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder addAllEntities( + java.lang.Iterable values) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, entities_); + onChanged(); + } else { + entitiesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder clearEntities() { + if (entitiesBuilder_ == null) { + entities_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + entitiesBuilder_.clear(); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public Builder removeEntities(int index) { + if (entitiesBuilder_ == null) { + ensureEntitiesIsMutable(); + entities_.remove(index); + onChanged(); + } else { + entitiesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public com.google.cloud.language.v1.Entity.Builder getEntitiesBuilder( + int index) { + return getEntitiesFieldBuilder().getBuilder(index); + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index) { + if (entitiesBuilder_ == null) { + return entities_.get(index); } else { + return entitiesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public java.util.List + getEntitiesOrBuilderList() { + if (entitiesBuilder_ != null) { + return entitiesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(entities_); + } + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder() { + return getEntitiesFieldBuilder().addBuilder( + com.google.cloud.language.v1.Entity.getDefaultInstance()); + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder( + int index) { + return getEntitiesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.Entity.getDefaultInstance()); + } + /** + *
+     * Entities, along with their semantic information, in the input document.
+     * Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+     * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + public java.util.List + getEntitiesBuilderList() { + return getEntitiesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder> + getEntitiesFieldBuilder() { + if (entitiesBuilder_ == null) { + entitiesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.Entity, com.google.cloud.language.v1.Entity.Builder, com.google.cloud.language.v1.EntityOrBuilder>( + entities_, + ((bitField0_ & 0x00000004) != 0), + getParentForChildren(), + isClean()); + entities_ = null; + } + return entitiesBuilder_; + } + + private com.google.cloud.language.v1.Sentiment documentSentiment_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder> documentSentimentBuilder_; + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @return Whether the documentSentiment field is set. + */ + public boolean hasDocumentSentiment() { + return documentSentimentBuilder_ != null || documentSentiment_ != null; + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @return The documentSentiment. + */ + public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { + if (documentSentimentBuilder_ == null) { + return documentSentiment_ == null ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_; + } else { + return documentSentimentBuilder_.getMessage(); + } + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + public Builder setDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { + if (documentSentimentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + documentSentiment_ = value; + onChanged(); + } else { + documentSentimentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + public Builder setDocumentSentiment( + com.google.cloud.language.v1.Sentiment.Builder builderForValue) { + if (documentSentimentBuilder_ == null) { + documentSentiment_ = builderForValue.build(); + onChanged(); + } else { + documentSentimentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + public Builder mergeDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { + if (documentSentimentBuilder_ == null) { + if (documentSentiment_ != null) { + documentSentiment_ = + com.google.cloud.language.v1.Sentiment.newBuilder(documentSentiment_).mergeFrom(value).buildPartial(); + } else { + documentSentiment_ = value; + } + onChanged(); + } else { + documentSentimentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + public Builder clearDocumentSentiment() { + if (documentSentimentBuilder_ == null) { + documentSentiment_ = null; + onChanged(); + } else { + documentSentiment_ = null; + documentSentimentBuilder_ = null; + } + + return this; + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + public com.google.cloud.language.v1.Sentiment.Builder getDocumentSentimentBuilder() { + + onChanged(); + return getDocumentSentimentFieldBuilder().getBuilder(); + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { + if (documentSentimentBuilder_ != null) { + return documentSentimentBuilder_.getMessageOrBuilder(); + } else { + return documentSentiment_ == null ? + com.google.cloud.language.v1.Sentiment.getDefaultInstance() : documentSentiment_; + } + } + /** + *
+     * The overall sentiment for the document. Populated if the user enables
+     * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+     * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder> + getDocumentSentimentFieldBuilder() { + if (documentSentimentBuilder_ == null) { + documentSentimentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Sentiment, com.google.cloud.language.v1.Sentiment.Builder, com.google.cloud.language.v1.SentimentOrBuilder>( + getDocumentSentiment(), + getParentForChildren(), + isClean()); + documentSentiment_ = null; + } + return documentSentimentBuilder_; + } + + private java.lang.Object language_ = ""; + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 5; + * @return The language. + */ + public java.lang.String getLanguage() { + java.lang.Object ref = language_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + language_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 5; + * @return The bytes for language. + */ + public com.google.protobuf.ByteString + getLanguageBytes() { + java.lang.Object ref = language_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + language_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 5; + * @param value The language to set. + * @return This builder for chaining. + */ + public Builder setLanguage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + language_ = value; + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 5; + * @return This builder for chaining. + */ + public Builder clearLanguage() { + + language_ = getDefaultInstance().getLanguage(); + onChanged(); + return this; + } + /** + *
+     * The language of the text, which will be the same as the language specified
+     * in the request or, if not specified, the automatically-detected language.
+     * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+     * 
+ * + * string language = 5; + * @param value The bytes for language to set. + * @return This builder for chaining. + */ + public Builder setLanguageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + language_ = value; + onChanged(); + return this; + } + + private java.util.List categories_ = + java.util.Collections.emptyList(); + private void ensureCategoriesIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + categories_ = new java.util.ArrayList(categories_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.ClassificationCategory, com.google.cloud.language.v1.ClassificationCategory.Builder, com.google.cloud.language.v1.ClassificationCategoryOrBuilder> categoriesBuilder_; + + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public java.util.List getCategoriesList() { + if (categoriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(categories_); + } else { + return categoriesBuilder_.getMessageList(); + } + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public int getCategoriesCount() { + if (categoriesBuilder_ == null) { + return categories_.size(); + } else { + return categoriesBuilder_.getCount(); + } + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { + if (categoriesBuilder_ == null) { + return categories_.get(index); + } else { + return categoriesBuilder_.getMessage(index); + } + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder setCategories( + int index, com.google.cloud.language.v1.ClassificationCategory value) { + if (categoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.set(index, value); + onChanged(); + } else { + categoriesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder setCategories( + int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.set(index, builderForValue.build()); + onChanged(); + } else { + categoriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder addCategories(com.google.cloud.language.v1.ClassificationCategory value) { + if (categoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.add(value); + onChanged(); + } else { + categoriesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder addCategories( + int index, com.google.cloud.language.v1.ClassificationCategory value) { + if (categoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.add(index, value); + onChanged(); + } else { + categoriesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder addCategories( + com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.add(builderForValue.build()); + onChanged(); + } else { + categoriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder addCategories( + int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.add(index, builderForValue.build()); + onChanged(); + } else { + categoriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder addAllCategories( + java.lang.Iterable values) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, categories_); + onChanged(); + } else { + categoriesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder clearCategories() { + if (categoriesBuilder_ == null) { + categories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + categoriesBuilder_.clear(); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public Builder removeCategories(int index) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.remove(index); + onChanged(); + } else { + categoriesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public com.google.cloud.language.v1.ClassificationCategory.Builder getCategoriesBuilder( + int index) { + return getCategoriesFieldBuilder().getBuilder(index); + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( + int index) { + if (categoriesBuilder_ == null) { + return categories_.get(index); } else { + return categoriesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public java.util.List + getCategoriesOrBuilderList() { + if (categoriesBuilder_ != null) { + return categoriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(categories_); + } + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder() { + return getCategoriesFieldBuilder().addBuilder( + com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder( + int index) { + return getCategoriesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); + } + /** + *
+     * Categories identified in the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + public java.util.List + getCategoriesBuilderList() { + return getCategoriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.ClassificationCategory, com.google.cloud.language.v1.ClassificationCategory.Builder, com.google.cloud.language.v1.ClassificationCategoryOrBuilder> + getCategoriesFieldBuilder() { + if (categoriesBuilder_ == null) { + categoriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.ClassificationCategory, com.google.cloud.language.v1.ClassificationCategory.Builder, com.google.cloud.language.v1.ClassificationCategoryOrBuilder>( + categories_, + ((bitField0_ & 0x00000008) != 0), + getParentForChildren(), + isClean()); + categories_ = null; + } + return categoriesBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnnotateTextResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnnotateTextResponse) + private static final com.google.cloud.language.v1.AnnotateTextResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnnotateTextResponse(); + } + + public static com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AnnotateTextResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AnnotateTextResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java new file mode 100644 index 000000000000..4e1c4cf4a943 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/AnnotateTextResponseOrBuilder.java @@ -0,0 +1,264 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface AnnotateTextResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.AnnotateTextResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + java.util.List + getSentencesList(); + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + com.google.cloud.language.v1.Sentence getSentences(int index); + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + int getSentencesCount(); + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + java.util.List + getSentencesOrBuilderList(); + /** + *
+   * Sentences in the input document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Sentence sentences = 1; + */ + com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder( + int index); + + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + java.util.List + getTokensList(); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + com.google.cloud.language.v1.Token getTokens(int index); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + int getTokensCount(); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + java.util.List + getTokensOrBuilderList(); + /** + *
+   * Tokens, along with their syntactic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax].
+   * 
+ * + * repeated .google.cloud.language.v1.Token tokens = 2; + */ + com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder( + int index); + + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + java.util.List + getEntitiesList(); + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + com.google.cloud.language.v1.Entity getEntities(int index); + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + int getEntitiesCount(); + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + java.util.List + getEntitiesOrBuilderList(); + /** + *
+   * Entities, along with their semantic information, in the input document.
+   * Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities].
+   * 
+ * + * repeated .google.cloud.language.v1.Entity entities = 3; + */ + com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder( + int index); + + /** + *
+   * The overall sentiment for the document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @return Whether the documentSentiment field is set. + */ + boolean hasDocumentSentiment(); + /** + *
+   * The overall sentiment for the document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + * @return The documentSentiment. + */ + com.google.cloud.language.v1.Sentiment getDocumentSentiment(); + /** + *
+   * The overall sentiment for the document. Populated if the user enables
+   * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment].
+   * 
+ * + * .google.cloud.language.v1.Sentiment document_sentiment = 4; + */ + com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder(); + + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 5; + * @return The language. + */ + java.lang.String getLanguage(); + /** + *
+   * The language of the text, which will be the same as the language specified
+   * in the request or, if not specified, the automatically-detected language.
+   * See [Document.language][google.cloud.language.v1.Document.language] field for more details.
+   * 
+ * + * string language = 5; + * @return The bytes for language. + */ + com.google.protobuf.ByteString + getLanguageBytes(); + + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + java.util.List + getCategoriesList(); + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + com.google.cloud.language.v1.ClassificationCategory getCategories(int index); + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + int getCategoriesCount(); + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + java.util.List + getCategoriesOrBuilderList(); + /** + *
+   * Categories identified in the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 6; + */ + com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( + int index); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java new file mode 100644 index 000000000000..9f66894f6db3 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategory.java @@ -0,0 +1,688 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * Represents a category returned from the text classifier.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationCategory} + */ +public final class ClassificationCategory extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationCategory) + ClassificationCategoryOrBuilder { +private static final long serialVersionUID = 0L; + // Use ClassificationCategory.newBuilder() to construct. + private ClassificationCategory(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ClassificationCategory() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ClassificationCategory(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ClassificationCategory( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 21: { + + confidence_ = input.readFloat(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationCategory_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationCategory_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationCategory.class, com.google.cloud.language.v1.ClassificationCategory.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + *
+   * The name of the category representing the document, from the [predefined
+   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * The name of the category representing the document, from the [predefined
+   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIDENCE_FIELD_NUMBER = 2; + private float confidence_; + /** + *
+   * The classifier's confidence of the category. Number represents how certain
+   * the classifier is that this category represents the given text.
+   * 
+ * + * float confidence = 2; + * @return The confidence. + */ + @java.lang.Override + public float getConfidence() { + return confidence_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { + output.writeFloat(2, confidence_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (java.lang.Float.floatToRawIntBits(confidence_) != 0) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(2, confidence_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.ClassificationCategory)) { + return super.equals(obj); + } + com.google.cloud.language.v1.ClassificationCategory other = (com.google.cloud.language.v1.ClassificationCategory) obj; + + if (!getName() + .equals(other.getName())) return false; + if (java.lang.Float.floatToIntBits(getConfidence()) + != java.lang.Float.floatToIntBits( + other.getConfidence())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + CONFIDENCE_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits( + getConfidence()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationCategory parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationCategory parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationCategory parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.ClassificationCategory prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Represents a category returned from the text classifier.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationCategory} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationCategory) + com.google.cloud.language.v1.ClassificationCategoryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationCategory_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationCategory_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationCategory.class, com.google.cloud.language.v1.ClassificationCategory.Builder.class); + } + + // Construct using com.google.cloud.language.v1.ClassificationCategory.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + confidence_ = 0F; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationCategory_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategory getDefaultInstanceForType() { + return com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategory build() { + com.google.cloud.language.v1.ClassificationCategory result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategory buildPartial() { + com.google.cloud.language.v1.ClassificationCategory result = new com.google.cloud.language.v1.ClassificationCategory(this); + result.name_ = name_; + result.confidence_ = confidence_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.ClassificationCategory) { + return mergeFrom((com.google.cloud.language.v1.ClassificationCategory)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.ClassificationCategory other) { + if (other == com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getConfidence() != 0F) { + setConfidence(other.getConfidence()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.ClassificationCategory parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.ClassificationCategory) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * The name of the category representing the document, from the [predefined
+     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The name of the category representing the document, from the [predefined
+     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The name of the category representing the document, from the [predefined
+     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + *
+     * The name of the category representing the document, from the [predefined
+     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + *
+     * The name of the category representing the document, from the [predefined
+     * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private float confidence_ ; + /** + *
+     * The classifier's confidence of the category. Number represents how certain
+     * the classifier is that this category represents the given text.
+     * 
+ * + * float confidence = 2; + * @return The confidence. + */ + @java.lang.Override + public float getConfidence() { + return confidence_; + } + /** + *
+     * The classifier's confidence of the category. Number represents how certain
+     * the classifier is that this category represents the given text.
+     * 
+ * + * float confidence = 2; + * @param value The confidence to set. + * @return This builder for chaining. + */ + public Builder setConfidence(float value) { + + confidence_ = value; + onChanged(); + return this; + } + /** + *
+     * The classifier's confidence of the category. Number represents how certain
+     * the classifier is that this category represents the given text.
+     * 
+ * + * float confidence = 2; + * @return This builder for chaining. + */ + public Builder clearConfidence() { + + confidence_ = 0F; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.ClassificationCategory) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationCategory) + private static final com.google.cloud.language.v1.ClassificationCategory DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationCategory(); + } + + public static com.google.cloud.language.v1.ClassificationCategory getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClassificationCategory parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClassificationCategory(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategory getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java new file mode 100644 index 000000000000..a10969d7d729 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationCategoryOrBuilder.java @@ -0,0 +1,42 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface ClassificationCategoryOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationCategory) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The name of the category representing the document, from the [predefined
+   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * The name of the category representing the document, from the [predefined
+   * taxonomy](https://cloud.google.com/natural-language/docs/categories).
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * The classifier's confidence of the category. Number represents how certain
+   * the classifier is that this category represents the given text.
+   * 
+ * + * float confidence = 2; + * @return The confidence. + */ + float getConfidence(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptions.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptions.java new file mode 100644 index 000000000000..b92f22e1409d --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptions.java @@ -0,0 +1,2206 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * Model options available for classification requests.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions} + */ +public final class ClassificationModelOptions extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationModelOptions) + ClassificationModelOptionsOrBuilder { +private static final long serialVersionUID = 0L; + // Use ClassificationModelOptions.newBuilder() to construct. + private ClassificationModelOptions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ClassificationModelOptions() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ClassificationModelOptions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ClassificationModelOptions( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder subBuilder = null; + if (modelTypeCase_ == 1) { + subBuilder = ((com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_).toBuilder(); + } + modelType_ = + input.readMessage(com.google.cloud.language.v1.ClassificationModelOptions.V1Model.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_); + modelType_ = subBuilder.buildPartial(); + } + modelTypeCase_ = 1; + break; + } + case 18: { + com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder subBuilder = null; + if (modelTypeCase_ == 2) { + subBuilder = ((com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_).toBuilder(); + } + modelType_ = + input.readMessage(com.google.cloud.language.v1.ClassificationModelOptions.V2Model.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_); + modelType_ = subBuilder.buildPartial(); + } + modelTypeCase_ = 2; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_ClassificationModelOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationModelOptions.class, com.google.cloud.language.v1.ClassificationModelOptions.Builder.class); + } + + public interface V1ModelOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationModelOptions.V1Model) + com.google.protobuf.MessageOrBuilder { + } + /** + *
+   * Options for the V1 model.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V1Model} + */ + public static final class V1Model extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationModelOptions.V1Model) + V1ModelOrBuilder { + private static final long serialVersionUID = 0L; + // Use V1Model.newBuilder() to construct. + private V1Model(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private V1Model() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new V1Model(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private V1Model( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_ClassificationModelOptions_V1Model_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationModelOptions.V1Model.class, com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder.class); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.ClassificationModelOptions.V1Model)) { + return super.equals(obj); + } + com.google.cloud.language.v1.ClassificationModelOptions.V1Model other = (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.ClassificationModelOptions.V1Model prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     * Options for the V1 model.
+     * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V1Model} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationModelOptions.V1Model) + com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationModelOptions.V1Model.class, com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder.class); + } + + // Construct using com.google.cloud.language.v1.ClassificationModelOptions.V1Model.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V1Model_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V1Model getDefaultInstanceForType() { + return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V1Model build() { + com.google.cloud.language.v1.ClassificationModelOptions.V1Model result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V1Model buildPartial() { + com.google.cloud.language.v1.ClassificationModelOptions.V1Model result = new com.google.cloud.language.v1.ClassificationModelOptions.V1Model(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.ClassificationModelOptions.V1Model) { + return mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions.V1Model)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.ClassificationModelOptions.V1Model other) { + if (other == com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance()) return this; + this.mergeUnknownFields(other.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.ClassificationModelOptions.V1Model parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.ClassificationModelOptions.V1Model) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationModelOptions.V1Model) + private static final com.google.cloud.language.v1.ClassificationModelOptions.V1Model DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationModelOptions.V1Model(); + } + + public static com.google.cloud.language.v1.ClassificationModelOptions.V1Model getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public V1Model parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new V1Model(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.ClassificationModelOptions.V1Model getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface V2ModelOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationModelOptions.V2Model) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * The content categories used for classification.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return The enum numeric value on the wire for contentCategoriesVersion. + */ + int getContentCategoriesVersionValue(); + /** + *
+     * The content categories used for classification.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return The contentCategoriesVersion. + */ + com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion getContentCategoriesVersion(); + } + /** + *
+   * Options for the V2 model.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V2Model} + */ + public static final class V2Model extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassificationModelOptions.V2Model) + V2ModelOrBuilder { + private static final long serialVersionUID = 0L; + // Use V2Model.newBuilder() to construct. + private V2Model(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private V2Model() { + contentCategoriesVersion_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new V2Model(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private V2Model( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int rawValue = input.readEnum(); + + contentCategoriesVersion_ = rawValue; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_ClassificationModelOptions_V2Model_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationModelOptions.V2Model.class, com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder.class); + } + + /** + *
+     * The content categories used for classification.
+     * 
+ * + * Protobuf enum {@code google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion} + */ + public enum ContentCategoriesVersion + implements com.google.protobuf.ProtocolMessageEnum { + /** + *
+       * If `ContentCategoriesVersion` is not specified, this option will
+       * default to `V1`.
+       * 
+ * + * CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + */ + CONTENT_CATEGORIES_VERSION_UNSPECIFIED(0), + /** + *
+       * Legacy content categories of our initial launch in 2017.
+       * 
+ * + * V1 = 1; + */ + V1(1), + /** + *
+       * Updated content categories in 2022.
+       * 
+ * + * V2 = 2; + */ + V2(2), + UNRECOGNIZED(-1), + ; + + /** + *
+       * If `ContentCategoriesVersion` is not specified, this option will
+       * default to `V1`.
+       * 
+ * + * CONTENT_CATEGORIES_VERSION_UNSPECIFIED = 0; + */ + public static final int CONTENT_CATEGORIES_VERSION_UNSPECIFIED_VALUE = 0; + /** + *
+       * Legacy content categories of our initial launch in 2017.
+       * 
+ * + * V1 = 1; + */ + public static final int V1_VALUE = 1; + /** + *
+       * Updated content categories in 2022.
+       * 
+ * + * V2 = 2; + */ + public static final int V2_VALUE = 2; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ContentCategoriesVersion valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static ContentCategoriesVersion forNumber(int value) { + switch (value) { + case 0: return CONTENT_CATEGORIES_VERSION_UNSPECIFIED; + case 1: return V1; + case 2: return V2; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + ContentCategoriesVersion> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ContentCategoriesVersion findValueByNumber(int number) { + return ContentCategoriesVersion.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDescriptor().getEnumTypes().get(0); + } + + private static final ContentCategoriesVersion[] VALUES = values(); + + public static ContentCategoriesVersion valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private ContentCategoriesVersion(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion) + } + + public static final int CONTENT_CATEGORIES_VERSION_FIELD_NUMBER = 1; + private int contentCategoriesVersion_; + /** + *
+     * The content categories used for classification.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return The enum numeric value on the wire for contentCategoriesVersion. + */ + @java.lang.Override public int getContentCategoriesVersionValue() { + return contentCategoriesVersion_; + } + /** + *
+     * The content categories used for classification.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return The contentCategoriesVersion. + */ + @java.lang.Override public com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion getContentCategoriesVersion() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion result = com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion.valueOf(contentCategoriesVersion_); + return result == null ? com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion.UNRECOGNIZED : result; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (contentCategoriesVersion_ != com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion.CONTENT_CATEGORIES_VERSION_UNSPECIFIED.getNumber()) { + output.writeEnum(1, contentCategoriesVersion_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (contentCategoriesVersion_ != com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion.CONTENT_CATEGORIES_VERSION_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, contentCategoriesVersion_); + } + size += 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.ClassificationModelOptions.V2Model)) { + return super.equals(obj); + } + com.google.cloud.language.v1.ClassificationModelOptions.V2Model other = (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) obj; + + if (contentCategoriesVersion_ != other.contentCategoriesVersion_) return false; + if (!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) + CONTENT_CATEGORIES_VERSION_FIELD_NUMBER; + hash = (53 * hash) + contentCategoriesVersion_; + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.ClassificationModelOptions.V2Model prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     * Options for the V2 model.
+     * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions.V2Model} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationModelOptions.V2Model) + com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationModelOptions.V2Model.class, com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder.class); + } + + // Construct using com.google.cloud.language.v1.ClassificationModelOptions.V2Model.newBuilder() + private Builder() { + 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(); + contentCategoriesVersion_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_V2Model_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2Model getDefaultInstanceForType() { + return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2Model build() { + com.google.cloud.language.v1.ClassificationModelOptions.V2Model result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2Model buildPartial() { + com.google.cloud.language.v1.ClassificationModelOptions.V2Model result = new com.google.cloud.language.v1.ClassificationModelOptions.V2Model(this); + result.contentCategoriesVersion_ = contentCategoriesVersion_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.ClassificationModelOptions.V2Model) { + return mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions.V2Model)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.ClassificationModelOptions.V2Model other) { + if (other == com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance()) return this; + if (other.contentCategoriesVersion_ != 0) { + setContentCategoriesVersionValue(other.getContentCategoriesVersionValue()); + } + this.mergeUnknownFields(other.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.ClassificationModelOptions.V2Model parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int contentCategoriesVersion_ = 0; + /** + *
+       * The content categories used for classification.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return The enum numeric value on the wire for contentCategoriesVersion. + */ + @java.lang.Override public int getContentCategoriesVersionValue() { + return contentCategoriesVersion_; + } + /** + *
+       * The content categories used for classification.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @param value The enum numeric value on the wire for contentCategoriesVersion to set. + * @return This builder for chaining. + */ + public Builder setContentCategoriesVersionValue(int value) { + + contentCategoriesVersion_ = value; + onChanged(); + return this; + } + /** + *
+       * The content categories used for classification.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return The contentCategoriesVersion. + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion getContentCategoriesVersion() { + @SuppressWarnings("deprecation") + com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion result = com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion.valueOf(contentCategoriesVersion_); + return result == null ? com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion.UNRECOGNIZED : result; + } + /** + *
+       * The content categories used for classification.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @param value The contentCategoriesVersion to set. + * @return This builder for chaining. + */ + public Builder setContentCategoriesVersion(com.google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion value) { + if (value == null) { + throw new NullPointerException(); + } + + contentCategoriesVersion_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+       * The content categories used for classification.
+       * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model.ContentCategoriesVersion content_categories_version = 1; + * @return This builder for chaining. + */ + public Builder clearContentCategoriesVersion() { + + contentCategoriesVersion_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.ClassificationModelOptions.V2Model) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationModelOptions.V2Model) + private static final com.google.cloud.language.v1.ClassificationModelOptions.V2Model DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationModelOptions.V2Model(); + } + + public static com.google.cloud.language.v1.ClassificationModelOptions.V2Model getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public V2Model parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new V2Model(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.ClassificationModelOptions.V2Model getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private int modelTypeCase_ = 0; + private java.lang.Object modelType_; + public enum ModelTypeCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + V1_MODEL(1), + V2_MODEL(2), + MODELTYPE_NOT_SET(0); + private final int value; + private ModelTypeCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ModelTypeCase valueOf(int value) { + return forNumber(value); + } + + public static ModelTypeCase forNumber(int value) { + switch (value) { + case 1: return V1_MODEL; + case 2: return V2_MODEL; + case 0: return MODELTYPE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public ModelTypeCase + getModelTypeCase() { + return ModelTypeCase.forNumber( + modelTypeCase_); + } + + public static final int V1_MODEL_FIELD_NUMBER = 1; + /** + *
+   * Setting this field will use the V1 model and V1 content categories
+   * version. The V1 model is a legacy model; support for this will be
+   * discontinued in the future.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @return Whether the v1Model field is set. + */ + @java.lang.Override + public boolean hasV1Model() { + return modelTypeCase_ == 1; + } + /** + *
+   * Setting this field will use the V1 model and V1 content categories
+   * version. The V1 model is a legacy model; support for this will be
+   * discontinued in the future.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @return The v1Model. + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V1Model getV1Model() { + if (modelTypeCase_ == 1) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); + } + /** + *
+   * Setting this field will use the V1 model and V1 content categories
+   * version. The V1 model is a legacy model; support for this will be
+   * discontinued in the future.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder getV1ModelOrBuilder() { + if (modelTypeCase_ == 1) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); + } + + public static final int V2_MODEL_FIELD_NUMBER = 2; + /** + *
+   * Setting this field will use the V2 model with the appropriate content
+   * categories version. The V2 model is a better performing model.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @return Whether the v2Model field is set. + */ + @java.lang.Override + public boolean hasV2Model() { + return modelTypeCase_ == 2; + } + /** + *
+   * Setting this field will use the V2 model with the appropriate content
+   * categories version. The V2 model is a better performing model.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @return The v2Model. + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2Model getV2Model() { + if (modelTypeCase_ == 2) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); + } + /** + *
+   * Setting this field will use the V2 model with the appropriate content
+   * categories version. The V2 model is a better performing model.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder getV2ModelOrBuilder() { + if (modelTypeCase_ == 2) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (modelTypeCase_ == 1) { + output.writeMessage(1, (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_); + } + if (modelTypeCase_ == 2) { + output.writeMessage(2, (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (modelTypeCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_); + } + if (modelTypeCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_); + } + size += 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.ClassificationModelOptions)) { + return super.equals(obj); + } + com.google.cloud.language.v1.ClassificationModelOptions other = (com.google.cloud.language.v1.ClassificationModelOptions) obj; + + if (!getModelTypeCase().equals(other.getModelTypeCase())) return false; + switch (modelTypeCase_) { + case 1: + if (!getV1Model() + .equals(other.getV1Model())) return false; + break; + case 2: + if (!getV2Model() + .equals(other.getV2Model())) return false; + break; + case 0: + default: + } + if (!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(); + switch (modelTypeCase_) { + case 1: + hash = (37 * hash) + V1_MODEL_FIELD_NUMBER; + hash = (53 * hash) + getV1Model().hashCode(); + break; + case 2: + hash = (37 * hash) + V2_MODEL_FIELD_NUMBER; + hash = (53 * hash) + getV2Model().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassificationModelOptions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.ClassificationModelOptions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Model options available for classification requests.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassificationModelOptions} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassificationModelOptions) + com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassificationModelOptions.class, com.google.cloud.language.v1.ClassificationModelOptions.Builder.class); + } + + // Construct using com.google.cloud.language.v1.ClassificationModelOptions.newBuilder() + private Builder() { + 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(); + modelTypeCase_ = 0; + modelType_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassificationModelOptions_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions getDefaultInstanceForType() { + return com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions build() { + com.google.cloud.language.v1.ClassificationModelOptions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions buildPartial() { + com.google.cloud.language.v1.ClassificationModelOptions result = new com.google.cloud.language.v1.ClassificationModelOptions(this); + if (modelTypeCase_ == 1) { + if (v1ModelBuilder_ == null) { + result.modelType_ = modelType_; + } else { + result.modelType_ = v1ModelBuilder_.build(); + } + } + if (modelTypeCase_ == 2) { + if (v2ModelBuilder_ == null) { + result.modelType_ = modelType_; + } else { + result.modelType_ = v2ModelBuilder_.build(); + } + } + result.modelTypeCase_ = modelTypeCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.ClassificationModelOptions) { + return mergeFrom((com.google.cloud.language.v1.ClassificationModelOptions)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.ClassificationModelOptions other) { + if (other == com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance()) return this; + switch (other.getModelTypeCase()) { + case V1_MODEL: { + mergeV1Model(other.getV1Model()); + break; + } + case V2_MODEL: { + mergeV2Model(other.getV2Model()); + break; + } + case MODELTYPE_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.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.ClassificationModelOptions parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.ClassificationModelOptions) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int modelTypeCase_ = 0; + private java.lang.Object modelType_; + public ModelTypeCase + getModelTypeCase() { + return ModelTypeCase.forNumber( + modelTypeCase_); + } + + public Builder clearModelType() { + modelTypeCase_ = 0; + modelType_ = null; + onChanged(); + return this; + } + + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions.V1Model, com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder, com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder> v1ModelBuilder_; + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @return Whether the v1Model field is set. + */ + @java.lang.Override + public boolean hasV1Model() { + return modelTypeCase_ == 1; + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @return The v1Model. + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V1Model getV1Model() { + if (v1ModelBuilder_ == null) { + if (modelTypeCase_ == 1) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); + } else { + if (modelTypeCase_ == 1) { + return v1ModelBuilder_.getMessage(); + } + return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); + } + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + public Builder setV1Model(com.google.cloud.language.v1.ClassificationModelOptions.V1Model value) { + if (v1ModelBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + modelType_ = value; + onChanged(); + } else { + v1ModelBuilder_.setMessage(value); + } + modelTypeCase_ = 1; + return this; + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + public Builder setV1Model( + com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder builderForValue) { + if (v1ModelBuilder_ == null) { + modelType_ = builderForValue.build(); + onChanged(); + } else { + v1ModelBuilder_.setMessage(builderForValue.build()); + } + modelTypeCase_ = 1; + return this; + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + public Builder mergeV1Model(com.google.cloud.language.v1.ClassificationModelOptions.V1Model value) { + if (v1ModelBuilder_ == null) { + if (modelTypeCase_ == 1 && + modelType_ != com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance()) { + modelType_ = com.google.cloud.language.v1.ClassificationModelOptions.V1Model.newBuilder((com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_) + .mergeFrom(value).buildPartial(); + } else { + modelType_ = value; + } + onChanged(); + } else { + if (modelTypeCase_ == 1) { + v1ModelBuilder_.mergeFrom(value); + } else { + v1ModelBuilder_.setMessage(value); + } + } + modelTypeCase_ = 1; + return this; + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + public Builder clearV1Model() { + if (v1ModelBuilder_ == null) { + if (modelTypeCase_ == 1) { + modelTypeCase_ = 0; + modelType_ = null; + onChanged(); + } + } else { + if (modelTypeCase_ == 1) { + modelTypeCase_ = 0; + modelType_ = null; + } + v1ModelBuilder_.clear(); + } + return this; + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + public com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder getV1ModelBuilder() { + return getV1ModelFieldBuilder().getBuilder(); + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder getV1ModelOrBuilder() { + if ((modelTypeCase_ == 1) && (v1ModelBuilder_ != null)) { + return v1ModelBuilder_.getMessageOrBuilder(); + } else { + if (modelTypeCase_ == 1) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); + } + } + /** + *
+     * Setting this field will use the V1 model and V1 content categories
+     * version. The V1 model is a legacy model; support for this will be
+     * discontinued in the future.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions.V1Model, com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder, com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder> + getV1ModelFieldBuilder() { + if (v1ModelBuilder_ == null) { + if (!(modelTypeCase_ == 1)) { + modelType_ = com.google.cloud.language.v1.ClassificationModelOptions.V1Model.getDefaultInstance(); + } + v1ModelBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions.V1Model, com.google.cloud.language.v1.ClassificationModelOptions.V1Model.Builder, com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder>( + (com.google.cloud.language.v1.ClassificationModelOptions.V1Model) modelType_, + getParentForChildren(), + isClean()); + modelType_ = null; + } + modelTypeCase_ = 1; + onChanged();; + return v1ModelBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions.V2Model, com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder, com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder> v2ModelBuilder_; + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @return Whether the v2Model field is set. + */ + @java.lang.Override + public boolean hasV2Model() { + return modelTypeCase_ == 2; + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @return The v2Model. + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2Model getV2Model() { + if (v2ModelBuilder_ == null) { + if (modelTypeCase_ == 2) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); + } else { + if (modelTypeCase_ == 2) { + return v2ModelBuilder_.getMessage(); + } + return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); + } + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + public Builder setV2Model(com.google.cloud.language.v1.ClassificationModelOptions.V2Model value) { + if (v2ModelBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + modelType_ = value; + onChanged(); + } else { + v2ModelBuilder_.setMessage(value); + } + modelTypeCase_ = 2; + return this; + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + public Builder setV2Model( + com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder builderForValue) { + if (v2ModelBuilder_ == null) { + modelType_ = builderForValue.build(); + onChanged(); + } else { + v2ModelBuilder_.setMessage(builderForValue.build()); + } + modelTypeCase_ = 2; + return this; + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + public Builder mergeV2Model(com.google.cloud.language.v1.ClassificationModelOptions.V2Model value) { + if (v2ModelBuilder_ == null) { + if (modelTypeCase_ == 2 && + modelType_ != com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance()) { + modelType_ = com.google.cloud.language.v1.ClassificationModelOptions.V2Model.newBuilder((com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_) + .mergeFrom(value).buildPartial(); + } else { + modelType_ = value; + } + onChanged(); + } else { + if (modelTypeCase_ == 2) { + v2ModelBuilder_.mergeFrom(value); + } else { + v2ModelBuilder_.setMessage(value); + } + } + modelTypeCase_ = 2; + return this; + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + public Builder clearV2Model() { + if (v2ModelBuilder_ == null) { + if (modelTypeCase_ == 2) { + modelTypeCase_ = 0; + modelType_ = null; + onChanged(); + } + } else { + if (modelTypeCase_ == 2) { + modelTypeCase_ = 0; + modelType_ = null; + } + v2ModelBuilder_.clear(); + } + return this; + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + public com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder getV2ModelBuilder() { + return getV2ModelFieldBuilder().getBuilder(); + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder getV2ModelOrBuilder() { + if ((modelTypeCase_ == 2) && (v2ModelBuilder_ != null)) { + return v2ModelBuilder_.getMessageOrBuilder(); + } else { + if (modelTypeCase_ == 2) { + return (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_; + } + return com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); + } + } + /** + *
+     * Setting this field will use the V2 model with the appropriate content
+     * categories version. The V2 model is a better performing model.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions.V2Model, com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder, com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder> + getV2ModelFieldBuilder() { + if (v2ModelBuilder_ == null) { + if (!(modelTypeCase_ == 2)) { + modelType_ = com.google.cloud.language.v1.ClassificationModelOptions.V2Model.getDefaultInstance(); + } + v2ModelBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions.V2Model, com.google.cloud.language.v1.ClassificationModelOptions.V2Model.Builder, com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder>( + (com.google.cloud.language.v1.ClassificationModelOptions.V2Model) modelType_, + getParentForChildren(), + isClean()); + modelType_ = null; + } + modelTypeCase_ = 2; + onChanged();; + return v2ModelBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.ClassificationModelOptions) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassificationModelOptions) + private static final com.google.cloud.language.v1.ClassificationModelOptions DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassificationModelOptions(); + } + + public static com.google.cloud.language.v1.ClassificationModelOptions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClassificationModelOptions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClassificationModelOptions(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.ClassificationModelOptions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptionsOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptionsOrBuilder.java new file mode 100644 index 000000000000..15bab621de52 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassificationModelOptionsOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface ClassificationModelOptionsOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassificationModelOptions) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Setting this field will use the V1 model and V1 content categories
+   * version. The V1 model is a legacy model; support for this will be
+   * discontinued in the future.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @return Whether the v1Model field is set. + */ + boolean hasV1Model(); + /** + *
+   * Setting this field will use the V1 model and V1 content categories
+   * version. The V1 model is a legacy model; support for this will be
+   * discontinued in the future.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + * @return The v1Model. + */ + com.google.cloud.language.v1.ClassificationModelOptions.V1Model getV1Model(); + /** + *
+   * Setting this field will use the V1 model and V1 content categories
+   * version. The V1 model is a legacy model; support for this will be
+   * discontinued in the future.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V1Model v1_model = 1; + */ + com.google.cloud.language.v1.ClassificationModelOptions.V1ModelOrBuilder getV1ModelOrBuilder(); + + /** + *
+   * Setting this field will use the V2 model with the appropriate content
+   * categories version. The V2 model is a better performing model.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @return Whether the v2Model field is set. + */ + boolean hasV2Model(); + /** + *
+   * Setting this field will use the V2 model with the appropriate content
+   * categories version. The V2 model is a better performing model.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + * @return The v2Model. + */ + com.google.cloud.language.v1.ClassificationModelOptions.V2Model getV2Model(); + /** + *
+   * Setting this field will use the V2 model with the appropriate content
+   * categories version. The V2 model is a better performing model.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions.V2Model v2_model = 2; + */ + com.google.cloud.language.v1.ClassificationModelOptions.V2ModelOrBuilder getV2ModelOrBuilder(); + + public com.google.cloud.language.v1.ClassificationModelOptions.ModelTypeCase getModelTypeCase(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java new file mode 100644 index 000000000000..a77d41026935 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequest.java @@ -0,0 +1,913 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The document classification request message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassifyTextRequest} + */ +public final class ClassifyTextRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassifyTextRequest) + ClassifyTextRequestOrBuilder { +private static final long serialVersionUID = 0L; + // Use ClassifyTextRequest.newBuilder() to construct. + private ClassifyTextRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ClassifyTextRequest() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ClassifyTextRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ClassifyTextRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.cloud.language.v1.Document.Builder subBuilder = null; + if (document_ != null) { + subBuilder = document_.toBuilder(); + } + document_ = input.readMessage(com.google.cloud.language.v1.Document.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(document_); + document_ = subBuilder.buildPartial(); + } + + break; + } + case 26: { + com.google.cloud.language.v1.ClassificationModelOptions.Builder subBuilder = null; + if (classificationModelOptions_ != null) { + subBuilder = classificationModelOptions_.toBuilder(); + } + classificationModelOptions_ = input.readMessage(com.google.cloud.language.v1.ClassificationModelOptions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(classificationModelOptions_); + classificationModelOptions_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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_; + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + @java.lang.Override + public boolean hasDocument() { + return document_ != null; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + @java.lang.Override + public com.google.cloud.language.v1.Document getDocument() { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + return getDocument(); + } + + public static final int CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER = 3; + private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; + /** + *
+   * Model options to use for classification. Defaults to v1 options if not
+   * specified.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @return Whether the classificationModelOptions field is set. + */ + @java.lang.Override + public boolean hasClassificationModelOptions() { + return classificationModelOptions_ != null; + } + /** + *
+   * Model options to use for classification. Defaults to v1 options if not
+   * specified.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @return The classificationModelOptions. + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions() { + return classificationModelOptions_ == null ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() : classificationModelOptions_; + } + /** + *
+   * Model options to use for classification. Defaults to v1 options if not
+   * specified.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder getClassificationModelOptionsOrBuilder() { + return getClassificationModelOptions(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (document_ != null) { + output.writeMessage(1, getDocument()); + } + if (classificationModelOptions_ != null) { + output.writeMessage(3, getClassificationModelOptions()); + } + 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 (classificationModelOptions_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getClassificationModelOptions()); + } + 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 (hasClassificationModelOptions() != other.hasClassificationModelOptions()) return false; + if (hasClassificationModelOptions()) { + if (!getClassificationModelOptions() + .equals(other.getClassificationModelOptions())) 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 (hasClassificationModelOptions()) { + hash = (37 * hash) + CLASSIFICATION_MODEL_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getClassificationModelOptions().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; + } + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptions_ = null; + } else { + classificationModelOptions_ = null; + classificationModelOptionsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassifyTextRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassifyTextRequest getDefaultInstanceForType() { + return com.google.cloud.language.v1.ClassifyTextRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassifyTextRequest build() { + com.google.cloud.language.v1.ClassifyTextRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassifyTextRequest buildPartial() { + com.google.cloud.language.v1.ClassifyTextRequest result = new com.google.cloud.language.v1.ClassifyTextRequest(this); + if (documentBuilder_ == null) { + result.document_ = document_; + } else { + result.document_ = documentBuilder_.build(); + } + if (classificationModelOptionsBuilder_ == null) { + result.classificationModelOptions_ = classificationModelOptions_; + } else { + result.classificationModelOptions_ = classificationModelOptionsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.ClassifyTextRequest) { + return mergeFrom((com.google.cloud.language.v1.ClassifyTextRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.ClassifyTextRequest other) { + if (other == com.google.cloud.language.v1.ClassifyTextRequest.getDefaultInstance()) return this; + if (other.hasDocument()) { + mergeDocument(other.getDocument()); + } + if (other.hasClassificationModelOptions()) { + mergeClassificationModelOptions(other.getClassificationModelOptions()); + } + this.mergeUnknownFields(other.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_; + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + public boolean hasDocument() { + return documentBuilder_ != null || document_ != null; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + public com.google.cloud.language.v1.Document getDocument() { + if (documentBuilder_ == null) { + return document_ == null ? com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } else { + return documentBuilder_.getMessage(); + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + document_ = value; + onChanged(); + } else { + documentBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setDocument( + com.google.cloud.language.v1.Document.Builder builderForValue) { + if (documentBuilder_ == null) { + document_ = builderForValue.build(); + onChanged(); + } else { + documentBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeDocument(com.google.cloud.language.v1.Document value) { + if (documentBuilder_ == null) { + if (document_ != null) { + document_ = + com.google.cloud.language.v1.Document.newBuilder(document_).mergeFrom(value).buildPartial(); + } else { + document_ = value; + } + onChanged(); + } else { + documentBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearDocument() { + if (documentBuilder_ == null) { + document_ = null; + onChanged(); + } else { + document_ = null; + documentBuilder_ = null; + } + + return this; + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.Document.Builder getDocumentBuilder() { + + onChanged(); + return getDocumentFieldBuilder().getBuilder(); + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder() { + if (documentBuilder_ != null) { + return documentBuilder_.getMessageOrBuilder(); + } else { + return document_ == null ? + com.google.cloud.language.v1.Document.getDefaultInstance() : document_; + } + } + /** + *
+     * Required. Input document.
+     * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder> + getDocumentFieldBuilder() { + if (documentBuilder_ == null) { + documentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.Document, com.google.cloud.language.v1.Document.Builder, com.google.cloud.language.v1.DocumentOrBuilder>( + getDocument(), + getParentForChildren(), + isClean()); + document_ = null; + } + return documentBuilder_; + } + + private com.google.cloud.language.v1.ClassificationModelOptions classificationModelOptions_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions, com.google.cloud.language.v1.ClassificationModelOptions.Builder, com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> classificationModelOptionsBuilder_; + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @return Whether the classificationModelOptions field is set. + */ + public boolean hasClassificationModelOptions() { + return classificationModelOptionsBuilder_ != null || classificationModelOptions_ != null; + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @return The classificationModelOptions. + */ + public com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions() { + if (classificationModelOptionsBuilder_ == null) { + return classificationModelOptions_ == null ? com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() : classificationModelOptions_; + } else { + return classificationModelOptionsBuilder_.getMessage(); + } + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + public Builder setClassificationModelOptions(com.google.cloud.language.v1.ClassificationModelOptions value) { + if (classificationModelOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + classificationModelOptions_ = value; + onChanged(); + } else { + classificationModelOptionsBuilder_.setMessage(value); + } + + return this; + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + public Builder setClassificationModelOptions( + com.google.cloud.language.v1.ClassificationModelOptions.Builder builderForValue) { + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptions_ = builderForValue.build(); + onChanged(); + } else { + classificationModelOptionsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + public Builder mergeClassificationModelOptions(com.google.cloud.language.v1.ClassificationModelOptions value) { + if (classificationModelOptionsBuilder_ == null) { + if (classificationModelOptions_ != null) { + classificationModelOptions_ = + com.google.cloud.language.v1.ClassificationModelOptions.newBuilder(classificationModelOptions_).mergeFrom(value).buildPartial(); + } else { + classificationModelOptions_ = value; + } + onChanged(); + } else { + classificationModelOptionsBuilder_.mergeFrom(value); + } + + return this; + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + public Builder clearClassificationModelOptions() { + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptions_ = null; + onChanged(); + } else { + classificationModelOptions_ = null; + classificationModelOptionsBuilder_ = null; + } + + return this; + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + public com.google.cloud.language.v1.ClassificationModelOptions.Builder getClassificationModelOptionsBuilder() { + + onChanged(); + return getClassificationModelOptionsFieldBuilder().getBuilder(); + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + public com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder getClassificationModelOptionsOrBuilder() { + if (classificationModelOptionsBuilder_ != null) { + return classificationModelOptionsBuilder_.getMessageOrBuilder(); + } else { + return classificationModelOptions_ == null ? + com.google.cloud.language.v1.ClassificationModelOptions.getDefaultInstance() : classificationModelOptions_; + } + } + /** + *
+     * Model options to use for classification. Defaults to v1 options if not
+     * specified.
+     * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions, com.google.cloud.language.v1.ClassificationModelOptions.Builder, com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder> + getClassificationModelOptionsFieldBuilder() { + if (classificationModelOptionsBuilder_ == null) { + classificationModelOptionsBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.language.v1.ClassificationModelOptions, com.google.cloud.language.v1.ClassificationModelOptions.Builder, com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder>( + getClassificationModelOptions(), + getParentForChildren(), + isClean()); + classificationModelOptions_ = null; + } + return classificationModelOptionsBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.ClassifyTextRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassifyTextRequest) + private static final com.google.cloud.language.v1.ClassifyTextRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassifyTextRequest(); + } + + public static com.google.cloud.language.v1.ClassifyTextRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClassifyTextRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + 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/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java new file mode 100644 index 000000000000..2963b4e9fa14 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextRequestOrBuilder.java @@ -0,0 +1,66 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +public interface ClassifyTextRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:google.cloud.language.v1.ClassifyTextRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the document field is set. + */ + boolean hasDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The document. + */ + com.google.cloud.language.v1.Document getDocument(); + /** + *
+   * Required. Input document.
+   * 
+ * + * .google.cloud.language.v1.Document document = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.cloud.language.v1.DocumentOrBuilder getDocumentOrBuilder(); + + /** + *
+   * Model options to use for classification. Defaults to v1 options if not
+   * specified.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @return Whether the classificationModelOptions field is set. + */ + boolean hasClassificationModelOptions(); + /** + *
+   * Model options to use for classification. Defaults to v1 options if not
+   * specified.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + * @return The classificationModelOptions. + */ + com.google.cloud.language.v1.ClassificationModelOptions getClassificationModelOptions(); + /** + *
+   * Model options to use for classification. Defaults to v1 options if not
+   * specified.
+   * 
+ * + * .google.cloud.language.v1.ClassificationModelOptions classification_model_options = 3; + */ + com.google.cloud.language.v1.ClassificationModelOptionsOrBuilder getClassificationModelOptionsOrBuilder(); +} diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java new file mode 100644 index 000000000000..051497d30146 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponse.java @@ -0,0 +1,872 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * The document classification response message.
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassifyTextResponse} + */ +public final class ClassifyTextResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.ClassifyTextResponse) + ClassifyTextResponseOrBuilder { +private static final long serialVersionUID = 0L; + // Use ClassifyTextResponse.newBuilder() to construct. + private ClassifyTextResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ClassifyTextResponse() { + categories_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ClassifyTextResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ClassifyTextResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + categories_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + categories_.add( + input.readMessage(com.google.cloud.language.v1.ClassificationCategory.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + categories_ = java.util.Collections.unmodifiableList(categories_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassifyTextResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassifyTextResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassifyTextResponse.class, com.google.cloud.language.v1.ClassifyTextResponse.Builder.class); + } + + public static final int CATEGORIES_FIELD_NUMBER = 1; + private java.util.List categories_; + /** + *
+   * Categories representing the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + @java.lang.Override + public java.util.List getCategoriesList() { + return categories_; + } + /** + *
+   * Categories representing the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + @java.lang.Override + public java.util.List + getCategoriesOrBuilderList() { + return categories_; + } + /** + *
+   * Categories representing the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + @java.lang.Override + public int getCategoriesCount() { + return categories_.size(); + } + /** + *
+   * Categories representing the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { + return categories_.get(index); + } + /** + *
+   * Categories representing the input document.
+   * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + @java.lang.Override + public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( + int index) { + return categories_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < categories_.size(); i++) { + output.writeMessage(1, categories_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < categories_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, categories_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.language.v1.ClassifyTextResponse)) { + return super.equals(obj); + } + com.google.cloud.language.v1.ClassifyTextResponse other = (com.google.cloud.language.v1.ClassifyTextResponse) obj; + + if (!getCategoriesList() + .equals(other.getCategoriesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getCategoriesCount() > 0) { + hash = (37 * hash) + CATEGORIES_FIELD_NUMBER; + hash = (53 * hash) + getCategoriesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.google.cloud.language.v1.ClassifyTextResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.google.cloud.language.v1.ClassifyTextResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The document classification response message.
+   * 
+ * + * Protobuf type {@code google.cloud.language.v1.ClassifyTextResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.ClassifyTextResponse) + com.google.cloud.language.v1.ClassifyTextResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassifyTextResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassifyTextResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.ClassifyTextResponse.class, com.google.cloud.language.v1.ClassifyTextResponse.Builder.class); + } + + // Construct using com.google.cloud.language.v1.ClassifyTextResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getCategoriesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (categoriesBuilder_ == null) { + categories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + categoriesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_ClassifyTextResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassifyTextResponse getDefaultInstanceForType() { + return com.google.cloud.language.v1.ClassifyTextResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassifyTextResponse build() { + com.google.cloud.language.v1.ClassifyTextResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassifyTextResponse buildPartial() { + com.google.cloud.language.v1.ClassifyTextResponse result = new com.google.cloud.language.v1.ClassifyTextResponse(this); + int from_bitField0_ = bitField0_; + if (categoriesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + categories_ = java.util.Collections.unmodifiableList(categories_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.categories_ = categories_; + } else { + result.categories_ = categoriesBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.language.v1.ClassifyTextResponse) { + return mergeFrom((com.google.cloud.language.v1.ClassifyTextResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.language.v1.ClassifyTextResponse other) { + if (other == com.google.cloud.language.v1.ClassifyTextResponse.getDefaultInstance()) return this; + if (categoriesBuilder_ == null) { + if (!other.categories_.isEmpty()) { + if (categories_.isEmpty()) { + categories_ = other.categories_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureCategoriesIsMutable(); + categories_.addAll(other.categories_); + } + onChanged(); + } + } else { + if (!other.categories_.isEmpty()) { + if (categoriesBuilder_.isEmpty()) { + categoriesBuilder_.dispose(); + categoriesBuilder_ = null; + categories_ = other.categories_; + bitField0_ = (bitField0_ & ~0x00000001); + categoriesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getCategoriesFieldBuilder() : null; + } else { + categoriesBuilder_.addAllMessages(other.categories_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.language.v1.ClassifyTextResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.language.v1.ClassifyTextResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List categories_ = + java.util.Collections.emptyList(); + private void ensureCategoriesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + categories_ = new java.util.ArrayList(categories_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.ClassificationCategory, com.google.cloud.language.v1.ClassificationCategory.Builder, com.google.cloud.language.v1.ClassificationCategoryOrBuilder> categoriesBuilder_; + + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public java.util.List getCategoriesList() { + if (categoriesBuilder_ == null) { + return java.util.Collections.unmodifiableList(categories_); + } else { + return categoriesBuilder_.getMessageList(); + } + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public int getCategoriesCount() { + if (categoriesBuilder_ == null) { + return categories_.size(); + } else { + return categoriesBuilder_.getCount(); + } + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { + if (categoriesBuilder_ == null) { + return categories_.get(index); + } else { + return categoriesBuilder_.getMessage(index); + } + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder setCategories( + int index, com.google.cloud.language.v1.ClassificationCategory value) { + if (categoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.set(index, value); + onChanged(); + } else { + categoriesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder setCategories( + int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.set(index, builderForValue.build()); + onChanged(); + } else { + categoriesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder addCategories(com.google.cloud.language.v1.ClassificationCategory value) { + if (categoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.add(value); + onChanged(); + } else { + categoriesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder addCategories( + int index, com.google.cloud.language.v1.ClassificationCategory value) { + if (categoriesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureCategoriesIsMutable(); + categories_.add(index, value); + onChanged(); + } else { + categoriesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder addCategories( + com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.add(builderForValue.build()); + onChanged(); + } else { + categoriesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder addCategories( + int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.add(index, builderForValue.build()); + onChanged(); + } else { + categoriesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder addAllCategories( + java.lang.Iterable values) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, categories_); + onChanged(); + } else { + categoriesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder clearCategories() { + if (categoriesBuilder_ == null) { + categories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + categoriesBuilder_.clear(); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public Builder removeCategories(int index) { + if (categoriesBuilder_ == null) { + ensureCategoriesIsMutable(); + categories_.remove(index); + onChanged(); + } else { + categoriesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public com.google.cloud.language.v1.ClassificationCategory.Builder getCategoriesBuilder( + int index) { + return getCategoriesFieldBuilder().getBuilder(index); + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( + int index) { + if (categoriesBuilder_ == null) { + return categories_.get(index); } else { + return categoriesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public java.util.List + getCategoriesOrBuilderList() { + if (categoriesBuilder_ != null) { + return categoriesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(categories_); + } + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder() { + return getCategoriesFieldBuilder().addBuilder( + com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder( + int index) { + return getCategoriesFieldBuilder().addBuilder( + index, com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); + } + /** + *
+     * Categories representing the input document.
+     * 
+ * + * repeated .google.cloud.language.v1.ClassificationCategory categories = 1; + */ + public java.util.List + getCategoriesBuilderList() { + return getCategoriesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.ClassificationCategory, com.google.cloud.language.v1.ClassificationCategory.Builder, com.google.cloud.language.v1.ClassificationCategoryOrBuilder> + getCategoriesFieldBuilder() { + if (categoriesBuilder_ == null) { + categoriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.language.v1.ClassificationCategory, com.google.cloud.language.v1.ClassificationCategory.Builder, com.google.cloud.language.v1.ClassificationCategoryOrBuilder>( + categories_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + categories_ = null; + } + return categoriesBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.ClassifyTextResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.language.v1.ClassifyTextResponse) + private static final com.google.cloud.language.v1.ClassifyTextResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.google.cloud.language.v1.ClassifyTextResponse(); + } + + public static com.google.cloud.language.v1.ClassifyTextResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClassifyTextResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClassifyTextResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.language.v1.ClassifyTextResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java new file mode 100644 index 000000000000..49cd258f9f01 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/ClassifyTextResponseOrBuilder.java @@ -0,0 +1,53 @@ +// 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/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java new file mode 100644 index 000000000000..ca0b588d4963 --- /dev/null +++ b/owl-bot-staging/java-language/v1/proto-google-cloud-language-v1/src/main/java/com/google/cloud/language/v1/DependencyEdge.java @@ -0,0 +1,2158 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/language/v1/language_service.proto + +package com.google.cloud.language.v1; + +/** + *
+ * Represents dependency parse tree information for a token. (For more
+ * information on dependency labels, see
+ * http://www.aclweb.org/anthology/P13-2017
+ * 
+ * + * Protobuf type {@code google.cloud.language.v1.DependencyEdge} + */ +public final class DependencyEdge extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:google.cloud.language.v1.DependencyEdge) + DependencyEdgeOrBuilder { +private static final long serialVersionUID = 0L; + // Use DependencyEdge.newBuilder() to construct. + private DependencyEdge(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private DependencyEdge() { + label_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new DependencyEdge(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private DependencyEdge( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + headTokenIndex_ = input.readInt32(); + break; + } + case 16: { + int rawValue = input.readEnum(); + + label_ = rawValue; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_DependencyEdge_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_DependencyEdge_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.language.v1.DependencyEdge.class, com.google.cloud.language.v1.DependencyEdge.Builder.class); + } + + /** + *
+   * The parse label enum for the token.
+   * 
+ * + * Protobuf enum {@code google.cloud.language.v1.DependencyEdge.Label} + */ + public enum Label + implements com.google.protobuf.ProtocolMessageEnum { + /** + *
+     * Unknown
+     * 
+ * + * UNKNOWN = 0; + */ + UNKNOWN(0), + /** + *
+     * Abbreviation modifier
+     * 
+ * + * ABBREV = 1; + */ + ABBREV(1), + /** + *
+     * Adjectival complement
+     * 
+ * + * ACOMP = 2; + */ + ACOMP(2), + /** + *
+     * Adverbial clause modifier
+     * 
+ * + * ADVCL = 3; + */ + ADVCL(3), + /** + *
+     * Adverbial modifier
+     * 
+ * + * ADVMOD = 4; + */ + ADVMOD(4), + /** + *
+     * Adjectival modifier of an NP
+     * 
+ * + * AMOD = 5; + */ + AMOD(5), + /** + *
+     * Appositional modifier of an NP
+     * 
+ * + * APPOS = 6; + */ + APPOS(6), + /** + *
+     * Attribute dependent of a copular verb
+     * 
+ * + * ATTR = 7; + */ + ATTR(7), + /** + *
+     * Auxiliary (non-main) verb
+     * 
+ * + * AUX = 8; + */ + AUX(8), + /** + *
+     * Passive auxiliary
+     * 
+ * + * AUXPASS = 9; + */ + AUXPASS(9), + /** + *
+     * Coordinating conjunction
+     * 
+ * + * CC = 10; + */ + CC(10), + /** + *
+     * Clausal complement of a verb or adjective
+     * 
+ * + * CCOMP = 11; + */ + CCOMP(11), + /** + *
+     * Conjunct
+     * 
+ * + * CONJ = 12; + */ + CONJ(12), + /** + *
+     * Clausal subject
+     * 
+ * + * CSUBJ = 13; + */ + CSUBJ(13), + /** + *
+     * Clausal passive subject
+     * 
+ * + * CSUBJPASS = 14; + */ + CSUBJPASS(14), + /** + *
+     * Dependency (unable to determine)
+     * 
+ * + * DEP = 15; + */ + DEP(15), + /** + *
+     * Determiner
+     * 
+ * + * DET = 16; + */ + DET(16), + /** + *
+     * Discourse
+     * 
+ * + * DISCOURSE = 17; + */ + DISCOURSE(17), + /** + *
+     * Direct object
+     * 
+ * + * DOBJ = 18; + */ + DOBJ(18), + /** + *
+     * Expletive
+     * 
+ * + * EXPL = 19; + */ + EXPL(19), + /** + *
+     * Goes with (part of a word in a text not well edited)
+     * 
+ * + * GOESWITH = 20; + */ + GOESWITH(20), + /** + *
+     * Indirect object
+     * 
+ * + * IOBJ = 21; + */ + IOBJ(21), + /** + *
+     * Marker (word introducing a subordinate clause)
+     * 
+ * + * MARK = 22; + */ + MARK(22), + /** + *
+     * Multi-word expression
+     * 
+ * + * MWE = 23; + */ + MWE(23), + /** + *
+     * Multi-word verbal expression
+     * 
+ * + * MWV = 24; + */ + MWV(24), + /** + *
+     * Negation modifier
+     * 
+ * + * NEG = 25; + */ + NEG(25), + /** + *
+     * Noun compound modifier
+     * 
+ * + * NN = 26; + */ + NN(26), + /** + *
+     * Noun phrase used as an adverbial modifier
+     * 
+ * + * NPADVMOD = 27; + */ + NPADVMOD(27), + /** + *
+     * Nominal subject
+     * 
+ * + * NSUBJ = 28; + */ + NSUBJ(28), + /** + *
+     * Passive nominal subject
+     * 
+ * + * NSUBJPASS = 29; + */ + NSUBJPASS(29), + /** + *
+     * Numeric modifier of a noun
+     * 
+ * + * NUM = 30; + */ + NUM(30), + /** + *
+     * Element of compound number
+     * 
+ * + * NUMBER = 31; + */ + NUMBER(31), + /** + *
+     * Punctuation mark
+     * 
+ * + * P = 32; + */ + P(32), + /** + *
+     * Parataxis relation
+     * 
+ * + * PARATAXIS = 33; + */ + PARATAXIS(33), + /** + *
+     * Participial modifier
+     * 
+ * + * PARTMOD = 34; + */ + PARTMOD(34), + /** + *
+     * The complement of a preposition is a clause
+     * 
+ * + * PCOMP = 35; + */ + PCOMP(35), + /** + *
+     * Object of a preposition
+     * 
+ * + * POBJ = 36; + */ + POBJ(36), + /** + *
+     * Possession modifier
+     * 
+ * + * POSS = 37; + */ + POSS(37), + /** + *
+     * Postverbal negative particle
+     * 
+ * + * POSTNEG = 38; + */ + POSTNEG(38), + /** + *
+     * Predicate complement
+     * 
+ * + * PRECOMP = 39; + */ + PRECOMP(39), + /** + *
+     * Preconjunt
+     * 
+ * + * PRECONJ = 40; + */ + PRECONJ(40), + /** + *
+     * Predeterminer
+     * 
+ * + * PREDET = 41; + */ + PREDET(41), + /** + *
+     * Prefix
+     * 
+ * + * PREF = 42; + */ + PREF(42), + /** + *
+     * Prepositional modifier
+     * 
+ * + * PREP = 43; + */ + PREP(43), + /** + *
+     * The relationship between a verb and verbal morpheme
+     * 
+ * + * PRONL = 44; + */ + PRONL(44), + /** + *
+     * Particle
+     * 
+ * + * PRT = 45; + */ + PRT(45), + /** + *
+     * Associative or possessive marker
+     * 
+ * + * PS = 46; + */ + PS(46), + /** + *
+     * Quantifier phrase modifier
+     * 
+ * + * QUANTMOD = 47; + */ + QUANTMOD(47), + /** + *
+     * Relative clause modifier
+     * 
+ * + * RCMOD = 48; + */ + RCMOD(48), + /** + *
+     * Complementizer in relative clause
+     * 
+ * + * RCMODREL = 49; + */ + RCMODREL(49), + /** + *
+     * Ellipsis without a preceding predicate
+     * 
+ * + * RDROP = 50; + */ + RDROP(50), + /** + *
+     * Referent
+     * 
+ * + * REF = 51; + */ + REF(51), + /** + *
+     * Remnant
+     * 
+ * + * REMNANT = 52; + */ + REMNANT(52), + /** + *
+     * Reparandum
+     * 
+ * + * REPARANDUM = 53; + */ + REPARANDUM(53), + /** + *
+     * Root
+     * 
+ * + * ROOT = 54; + */ + ROOT(54), + /** + *
+     * Suffix specifying a unit of number
+     * 
+ * + * SNUM = 55; + */ + SNUM(55), + /** + *
+     * Suffix
+     * 
+ * + * SUFF = 56; + */ + SUFF(56), + /** + *
+     * Temporal modifier
+     * 
+ * + * TMOD = 57; + */ + TMOD(57), + /** + *
+     * Topic marker
+     * 
+ * + * TOPIC = 58; + */ + TOPIC(58), + /** + *
+     * Clause headed by an infinite form of the verb that modifies a noun
+     * 
+ * + * VMOD = 59; + */ + VMOD(59), + /** + *
+     * Vocative
+     * 
+ * + * VOCATIVE = 60; + */ + VOCATIVE(60), + /** + *
+     * Open clausal complement
+     * 
+ * + * XCOMP = 61; + */ + XCOMP(61), + /** + *
+     * Name suffix
+     * 
+ * + * SUFFIX = 62; + */ + SUFFIX(62), + /** + *
+     * Name title
+     * 
+ * + * TITLE = 63; + */ + TITLE(63), + /** + *
+     * Adverbial phrase modifier
+     * 
+ * + * ADVPHMOD = 64; + */ + ADVPHMOD(64), + /** + *
+     * Causative auxiliary
+     * 
+ * + * AUXCAUS = 65; + */ + AUXCAUS(65), + /** + *
+     * Helper auxiliary
+     * 
+ * + * AUXVV = 66; + */ + AUXVV(66), + /** + *
+     * Rentaishi (Prenominal modifier)
+     * 
+ * + * DTMOD = 67; + */ + DTMOD(67), + /** + *
+     * Foreign words
+     * 
+ * + * FOREIGN = 68; + */ + FOREIGN(68), + /** + *
+     * Keyword
+     * 
+ * + * KW = 69; + */ + KW(69), + /** + *
+     * List for chains of comparable items
+     * 
+ * + * LIST = 70; + */ + LIST(70), + /** + *
+     * Nominalized clause
+     * 
+ * + * NOMC = 71; + */ + NOMC(71), + /** + *
+     * Nominalized clausal subject
+     * 
+ * + * NOMCSUBJ = 72; + */ + NOMCSUBJ(72), + /** + *
+     * Nominalized clausal passive
+     * 
+ * + * NOMCSUBJPASS = 73; + */ + NOMCSUBJPASS(73), + /** + *
+     * Compound of numeric modifier
+     * 
+ * + * NUMC = 74; + */ + NUMC(74), + /** + *
+     * Copula
+     * 
+ * + * COP = 75; + */ + COP(75), + /** + *
+     * Dislocated relation (for fronted/topicalized elements)
+     * 
+ * + * DISLOCATED = 76; + */ + DISLOCATED(76), + /** + *
+     * Aspect marker
+     * 
+ * + * ASP = 77; + */ + ASP(77), + /** + *
+     * Genitive modifier
+     * 
+ * + * GMOD = 78; + */ + GMOD(78), + /** + *
+     * Genitive object
+     * 
+ * + * GOBJ = 79; + */ + GOBJ(79), + /** + *
+     * Infinitival modifier
+     * 
+ * + * INFMOD = 80; + */ + INFMOD(80), + /** + *
+     * Measure
+     * 
+ * + * MES = 81; + */ + MES(81), + /** + *
+     * Nominal complement of a noun
+     * 
+ * + * NCOMP = 82; + */ + NCOMP(82), + UNRECOGNIZED(-1), + ; + + /** + *
+     * Unknown
+     * 
+ * + * UNKNOWN = 0; + */ + public static final int UNKNOWN_VALUE = 0; + /** + *
+     * Abbreviation modifier
+     * 
+ * + * ABBREV = 1; + */ + public static final int ABBREV_VALUE = 1; + /** + *
+     * Adjectival complement
+     * 
+ * + * ACOMP = 2; + */ + public static final int ACOMP_VALUE = 2; + /** + *
+     * Adverbial clause modifier
+     * 
+ * + * ADVCL = 3; + */ + public static final int ADVCL_VALUE = 3; + /** + *
+     * Adverbial modifier
+     * 
+ * + * ADVMOD = 4; + */ + public static final int ADVMOD_VALUE = 4; + /** + *
+     * Adjectival modifier of an NP
+     * 
+ * + * AMOD = 5; + */ + public static final int AMOD_VALUE = 5; + /** + *
+     * Appositional modifier of an NP
+     * 
+ * + * APPOS = 6; + */ + public static final int APPOS_VALUE = 6; + /** + *
+     * Attribute dependent of a copular verb
+     * 
+ * + * ATTR = 7; + */ + public static final int ATTR_VALUE = 7; + /** + *
+     * Auxiliary (non-main) verb
+     * 
+ * + * AUX = 8; + */ + public static final int AUX_VALUE = 8; + /** + *
+     * Passive auxiliary
+     * 
+ * + * AUXPASS = 9; + */ + public static final int AUXPASS_VALUE = 9; + /** + *
+     * Coordinating conjunction
+     * 
+ * + * CC = 10; + */ + public static final int CC_VALUE = 10; + /** + *
+     * Clausal complement of a verb or adjective
+     * 
+ * + * CCOMP = 11; + */ + public static final int CCOMP_VALUE = 11; + /** + *
+     * Conjunct
+     * 
+ * + * CONJ = 12; + */ + public static final int CONJ_VALUE = 12; + /** + *
+     * Clausal subject
+     * 
+ * + * CSUBJ = 13; + */ + public static final int CSUBJ_VALUE = 13; + /** + *
+     * Clausal passive subject
+     * 
+ * + * CSUBJPASS = 14; + */ + public static final int CSUBJPASS_VALUE = 14; + /** + *
+     * Dependency (unable to determine)
+     * 
+ * + * DEP = 15; + */ + public static final int DEP_VALUE = 15; + /** + *
+     * Determiner
+     * 
+ * + * DET = 16; + */ + public static final int DET_VALUE = 16; + /** + *
+     * Discourse
+     * 
+ * + * DISCOURSE = 17; + */ + public static final int DISCOURSE_VALUE = 17; + /** + *
+     * Direct object
+     * 
+ * + * DOBJ = 18; + */ + public static final int DOBJ_VALUE = 18; + /** + *
+     * Expletive
+     * 
+ * + * EXPL = 19; + */ + public static final int EXPL_VALUE = 19; + /** + *
+     * Goes with (part of a word in a text not well edited)
+     * 
+ * + * GOESWITH = 20; + */ + public static final int GOESWITH_VALUE = 20; + /** + *
+     * Indirect object
+     * 
+ * + * IOBJ = 21; + */ + public static final int IOBJ_VALUE = 21; + /** + *
+     * Marker (word introducing a subordinate clause)
+     * 
+ * + * MARK = 22; + */ + public static final int MARK_VALUE = 22; + /** + *
+     * Multi-word expression
+     * 
+ * + * MWE = 23; + */ + public static final int MWE_VALUE = 23; + /** + *
+     * Multi-word verbal expression
+     * 
+ * + * MWV = 24; + */ + public static final int MWV_VALUE = 24; + /** + *
+     * Negation modifier
+     * 
+ * + * NEG = 25; + */ + public static final int NEG_VALUE = 25; + /** + *
+     * Noun compound modifier
+     * 
+ * + * NN = 26; + */ + public static final int NN_VALUE = 26; + /** + *
+     * Noun phrase used as an adverbial modifier
+     * 
+ * + * NPADVMOD = 27; + */ + public static final int NPADVMOD_VALUE = 27; + /** + *
+     * Nominal subject
+     * 
+ * + * NSUBJ = 28; + */ + public static final int NSUBJ_VALUE = 28; + /** + *
+     * Passive nominal subject
+     * 
+ * + * NSUBJPASS = 29; + */ + public static final int NSUBJPASS_VALUE = 29; + /** + *
+     * Numeric modifier of a noun
+     * 
+ * + * NUM = 30; + */ + public static final int NUM_VALUE = 30; + /** + *
+     * Element of compound number
+     * 
+ * + * NUMBER = 31; + */ + public static final int NUMBER_VALUE = 31; + /** + *
+     * Punctuation mark
+     * 
+ * + * P = 32; + */ + public static final int P_VALUE = 32; + /** + *
+     * Parataxis relation
+     * 
+ * + * PARATAXIS = 33; + */ + public static final int PARATAXIS_VALUE = 33; + /** + *
+     * Participial modifier
+     * 
+ * + * PARTMOD = 34; + */ + public static final int PARTMOD_VALUE = 34; + /** + *
+     * The complement of a preposition is a clause
+     * 
+ * + * PCOMP = 35; + */ + public static final int PCOMP_VALUE = 35; + /** + *
+     * Object of a preposition
+     * 
+ * + * POBJ = 36; + */ + public static final int POBJ_VALUE = 36; + /** + *
+     * Possession modifier
+     * 
+ * + * POSS = 37; + */ + public static final int POSS_VALUE = 37; + /** + *
+     * Postverbal negative particle
+     * 
+ * + * POSTNEG = 38; + */ + public static final int POSTNEG_VALUE = 38; + /** + *
+     * Predicate complement
+     * 
+ * + * PRECOMP = 39; + */ + public static final int PRECOMP_VALUE = 39; + /** + *
+     * Preconjunt
+     * 
+ * + * PRECONJ = 40; + */ + public static final int PRECONJ_VALUE = 40; + /** + *
+     * Predeterminer
+     * 
+ * + * PREDET = 41; + */ + public static final int PREDET_VALUE = 41; + /** + *
+     * Prefix
+     * 
+ * + * PREF = 42; + */ + public static final int PREF_VALUE = 42; + /** + *
+     * Prepositional modifier
+     * 
+ * + * PREP = 43; + */ + public static final int PREP_VALUE = 43; + /** + *
+     * The relationship between a verb and verbal morpheme
+     * 
+ * + * PRONL = 44; + */ + public static final int PRONL_VALUE = 44; + /** + *
+     * Particle
+     * 
+ * + * PRT = 45; + */ + public static final int PRT_VALUE = 45; + /** + *
+     * Associative or possessive marker
+     * 
+ * + * PS = 46; + */ + public static final int PS_VALUE = 46; + /** + *
+     * Quantifier phrase modifier
+     * 
+ * + * QUANTMOD = 47; + */ + public static final int QUANTMOD_VALUE = 47; + /** + *
+     * Relative clause modifier
+     * 
+ * + * RCMOD = 48; + */ + public static final int RCMOD_VALUE = 48; + /** + *
+     * Complementizer in relative clause
+     * 
+ * + * RCMODREL = 49; + */ + public static final int RCMODREL_VALUE = 49; + /** + *
+     * Ellipsis without a preceding predicate
+     * 
+ * + * RDROP = 50; + */ + public static final int RDROP_VALUE = 50; + /** + *
+     * Referent
+     * 
+ * + * REF = 51; + */ + public static final int REF_VALUE = 51; + /** + *
+     * Remnant
+     * 
+ * + * REMNANT = 52; + */ + public static final int REMNANT_VALUE = 52; + /** + *
+     * Reparandum
+     * 
+ * + * REPARANDUM = 53; + */ + public static final int REPARANDUM_VALUE = 53; + /** + *
+     * Root
+     * 
+ * + * ROOT = 54; + */ + public static final int ROOT_VALUE = 54; + /** + *
+     * Suffix specifying a unit of number
+     * 
+ * + * SNUM = 55; + */ + public static final int SNUM_VALUE = 55; + /** + *
+     * Suffix
+     * 
+ * + * SUFF = 56; + */ + public static final int SUFF_VALUE = 56; + /** + *
+     * Temporal modifier
+     * 
+ * + * TMOD = 57; + */ + public static final int TMOD_VALUE = 57; + /** + *
+     * Topic marker
+     * 
+ * + * TOPIC = 58; + */ + public static final int TOPIC_VALUE = 58; + /** + *
+     * Clause headed by an infinite form of the verb that modifies a noun
+     * 
+ * + * VMOD = 59; + */ + public static final int VMOD_VALUE = 59; + /** + *
+     * Vocative
+     * 
+ * + * VOCATIVE = 60; + */ + public static final int VOCATIVE_VALUE = 60; + /** + *
+     * Open clausal complement
+     * 
+ * + * XCOMP = 61; + */ + public static final int XCOMP_VALUE = 61; + /** + *
+     * Name suffix
+     * 
+ * + * SUFFIX = 62; + */ + public static final int SUFFIX_VALUE = 62; + /** + *
+     * Name title
+     * 
+ * + * TITLE = 63; + */ + public static final int TITLE_VALUE = 63; + /** + *
+     * Adverbial phrase modifier
+     * 
+ * + * ADVPHMOD = 64; + */ + public static final int ADVPHMOD_VALUE = 64; + /** + *
+     * Causative auxiliary
+     * 
+ * + * AUXCAUS = 65; + */ + public static final int AUXCAUS_VALUE = 65; + /** + *
+     * Helper auxiliary
+     * 
+ * + * AUXVV = 66; + */ + public static final int AUXVV_VALUE = 66; + /** + *
+     * Rentaishi (Prenominal modifier)
+     * 
+ * + * DTMOD = 67; + */ + public static final int DTMOD_VALUE = 67; + /** + *
+     * Foreign words
+     * 
+ * + * FOREIGN = 68; + */ + public static final int FOREIGN_VALUE = 68; + /** + *
+     * Keyword
+     * 
+ * + * KW = 69; + */ + public static final int KW_VALUE = 69; + /** + *
+     * List for chains of comparable items
+     * 
+ * + * LIST = 70; + */ + public static final int LIST_VALUE = 70; + /** + *
+     * Nominalized clause
+     * 
+ * + * NOMC = 71; + */ + public static final int NOMC_VALUE = 71; + /** + *
+     * Nominalized clausal subject
+     * 
+ * + * NOMCSUBJ = 72; + */ + public static final int NOMCSUBJ_VALUE = 72; + /** + *
+     * Nominalized clausal passive
+     * 
+ * + * NOMCSUBJPASS = 73; + */ + public static final int NOMCSUBJPASS_VALUE = 73; + /** + *
+     * Compound of numeric modifier
+     * 
+ * + * NUMC = 74; + */ + public static final int NUMC_VALUE = 74; + /** + *
+     * Copula
+     * 
+ * + * COP = 75; + */ + public static final int COP_VALUE = 75; + /** + *
+     * Dislocated relation (for fronted/topicalized elements)
+     * 
+ * + * DISLOCATED = 76; + */ + public static final int DISLOCATED_VALUE = 76; + /** + *
+     * Aspect marker
+     * 
+ * + * ASP = 77; + */ + public static final int ASP_VALUE = 77; + /** + *
+     * Genitive modifier
+     * 
+ * + * GMOD = 78; + */ + public static final int GMOD_VALUE = 78; + /** + *
+     * Genitive object
+     * 
+ * + * GOBJ = 79; + */ + public static final int GOBJ_VALUE = 79; + /** + *
+     * Infinitival modifier
+     * 
+ * + * INFMOD = 80; + */ + public static final int INFMOD_VALUE = 80; + /** + *
+     * Measure
+     * 
+ * + * MES = 81; + */ + public static final int MES_VALUE = 81; + /** + *
+     * Nominal complement of a noun
+     * 
+ * + * NCOMP = 82; + */ + public static final int NCOMP_VALUE = 82; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Label valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Label forNumber(int value) { + switch (value) { + case 0: return UNKNOWN; + case 1: return ABBREV; + case 2: return ACOMP; + case 3: return ADVCL; + case 4: return ADVMOD; + case 5: return AMOD; + case 6: return APPOS; + case 7: return ATTR; + case 8: return AUX; + case 9: return AUXPASS; + case 10: return CC; + case 11: return CCOMP; + case 12: return CONJ; + case 13: return CSUBJ; + case 14: return CSUBJPASS; + case 15: return DEP; + case 16: return DET; + case 17: return DISCOURSE; + case 18: return DOBJ; + case 19: return EXPL; + case 20: return GOESWITH; + case 21: return IOBJ; + case 22: return MARK; + case 23: return MWE; + case 24: return MWV; + case 25: return NEG; + case 26: return NN; + case 27: return NPADVMOD; + case 28: return NSUBJ; + case 29: return NSUBJPASS; + case 30: return NUM; + case 31: return NUMBER; + case 32: return P; + case 33: return PARATAXIS; + case 34: return PARTMOD; + case 35: return PCOMP; + case 36: return POBJ; + case 37: return POSS; + case 38: return POSTNEG; + case 39: return PRECOMP; + case 40: return PRECONJ; + case 41: return PREDET; + case 42: return PREF; + case 43: return PREP; + case 44: return PRONL; + case 45: return PRT; + case 46: return PS; + case 47: return QUANTMOD; + case 48: return RCMOD; + case 49: return RCMODREL; + case 50: return RDROP; + case 51: return REF; + case 52: return REMNANT; + case 53: return REPARANDUM; + case 54: return ROOT; + case 55: return SNUM; + case 56: return SUFF; + case 57: return TMOD; + case 58: return TOPIC; + case 59: return VMOD; + case 60: return VOCATIVE; + case 61: return XCOMP; + case 62: return SUFFIX; + case 63: return TITLE; + case 64: return ADVPHMOD; + case 65: return AUXCAUS; + case 66: return AUXVV; + case 67: return DTMOD; + case 68: return FOREIGN; + case 69: return KW; + case 70: return LIST; + case 71: return NOMC; + case 72: return NOMCSUBJ; + case 73: return NOMCSUBJPASS; + case 74: return NUMC; + case 75: return COP; + case 76: return DISLOCATED; + case 77: return ASP; + case 78: return GMOD; + case 79: return GOBJ; + case 80: return INFMOD; + case 81: return MES; + case 82: return NCOMP; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap