1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/language/v1/language_service.proto 18 19 package com.google.cloud.language.v1; 20 21 /** 22 * 23 * 24 * <pre> 25 * The text annotations response message. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.language.v1.AnnotateTextResponse} 29 */ 30 public final class AnnotateTextResponse extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.language.v1.AnnotateTextResponse) 33 AnnotateTextResponseOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use AnnotateTextResponse.newBuilder() to construct. AnnotateTextResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private AnnotateTextResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 AnnotateTextResponse()40 private AnnotateTextResponse() { 41 sentences_ = java.util.Collections.emptyList(); 42 tokens_ = java.util.Collections.emptyList(); 43 entities_ = java.util.Collections.emptyList(); 44 language_ = ""; 45 categories_ = java.util.Collections.emptyList(); 46 } 47 48 @java.lang.Override 49 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)50 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 51 return new AnnotateTextResponse(); 52 } 53 54 @java.lang.Override getUnknownFields()55 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 56 return this.unknownFields; 57 } 58 getDescriptor()59 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 60 return com.google.cloud.language.v1.LanguageServiceProto 61 .internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; 62 } 63 64 @java.lang.Override 65 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()66 internalGetFieldAccessorTable() { 67 return com.google.cloud.language.v1.LanguageServiceProto 68 .internal_static_google_cloud_language_v1_AnnotateTextResponse_fieldAccessorTable 69 .ensureFieldAccessorsInitialized( 70 com.google.cloud.language.v1.AnnotateTextResponse.class, 71 com.google.cloud.language.v1.AnnotateTextResponse.Builder.class); 72 } 73 74 public static final int SENTENCES_FIELD_NUMBER = 1; 75 76 @SuppressWarnings("serial") 77 private java.util.List<com.google.cloud.language.v1.Sentence> sentences_; 78 /** 79 * 80 * 81 * <pre> 82 * Sentences in the input document. Populated if the user enables 83 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 84 * </pre> 85 * 86 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 87 */ 88 @java.lang.Override getSentencesList()89 public java.util.List<com.google.cloud.language.v1.Sentence> getSentencesList() { 90 return sentences_; 91 } 92 /** 93 * 94 * 95 * <pre> 96 * Sentences in the input document. Populated if the user enables 97 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 98 * </pre> 99 * 100 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 101 */ 102 @java.lang.Override 103 public java.util.List<? extends com.google.cloud.language.v1.SentenceOrBuilder> getSentencesOrBuilderList()104 getSentencesOrBuilderList() { 105 return sentences_; 106 } 107 /** 108 * 109 * 110 * <pre> 111 * Sentences in the input document. Populated if the user enables 112 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 113 * </pre> 114 * 115 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 116 */ 117 @java.lang.Override getSentencesCount()118 public int getSentencesCount() { 119 return sentences_.size(); 120 } 121 /** 122 * 123 * 124 * <pre> 125 * Sentences in the input document. Populated if the user enables 126 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 127 * </pre> 128 * 129 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 130 */ 131 @java.lang.Override getSentences(int index)132 public com.google.cloud.language.v1.Sentence getSentences(int index) { 133 return sentences_.get(index); 134 } 135 /** 136 * 137 * 138 * <pre> 139 * Sentences in the input document. Populated if the user enables 140 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 141 * </pre> 142 * 143 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 144 */ 145 @java.lang.Override getSentencesOrBuilder(int index)146 public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { 147 return sentences_.get(index); 148 } 149 150 public static final int TOKENS_FIELD_NUMBER = 2; 151 152 @SuppressWarnings("serial") 153 private java.util.List<com.google.cloud.language.v1.Token> tokens_; 154 /** 155 * 156 * 157 * <pre> 158 * Tokens, along with their syntactic information, in the input document. 159 * Populated if the user enables 160 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 161 * </pre> 162 * 163 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 164 */ 165 @java.lang.Override getTokensList()166 public java.util.List<com.google.cloud.language.v1.Token> getTokensList() { 167 return tokens_; 168 } 169 /** 170 * 171 * 172 * <pre> 173 * Tokens, along with their syntactic information, in the input document. 174 * Populated if the user enables 175 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 176 * </pre> 177 * 178 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 179 */ 180 @java.lang.Override 181 public java.util.List<? extends com.google.cloud.language.v1.TokenOrBuilder> getTokensOrBuilderList()182 getTokensOrBuilderList() { 183 return tokens_; 184 } 185 /** 186 * 187 * 188 * <pre> 189 * Tokens, along with their syntactic information, in the input document. 190 * Populated if the user enables 191 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 192 * </pre> 193 * 194 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 195 */ 196 @java.lang.Override getTokensCount()197 public int getTokensCount() { 198 return tokens_.size(); 199 } 200 /** 201 * 202 * 203 * <pre> 204 * Tokens, along with their syntactic information, in the input document. 205 * Populated if the user enables 206 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 207 * </pre> 208 * 209 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 210 */ 211 @java.lang.Override getTokens(int index)212 public com.google.cloud.language.v1.Token getTokens(int index) { 213 return tokens_.get(index); 214 } 215 /** 216 * 217 * 218 * <pre> 219 * Tokens, along with their syntactic information, in the input document. 220 * Populated if the user enables 221 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 222 * </pre> 223 * 224 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 225 */ 226 @java.lang.Override getTokensOrBuilder(int index)227 public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index) { 228 return tokens_.get(index); 229 } 230 231 public static final int ENTITIES_FIELD_NUMBER = 3; 232 233 @SuppressWarnings("serial") 234 private java.util.List<com.google.cloud.language.v1.Entity> entities_; 235 /** 236 * 237 * 238 * <pre> 239 * Entities, along with their semantic information, in the input document. 240 * Populated if the user enables 241 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 242 * </pre> 243 * 244 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 245 */ 246 @java.lang.Override getEntitiesList()247 public java.util.List<com.google.cloud.language.v1.Entity> getEntitiesList() { 248 return entities_; 249 } 250 /** 251 * 252 * 253 * <pre> 254 * Entities, along with their semantic information, in the input document. 255 * Populated if the user enables 256 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 257 * </pre> 258 * 259 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 260 */ 261 @java.lang.Override 262 public java.util.List<? extends com.google.cloud.language.v1.EntityOrBuilder> getEntitiesOrBuilderList()263 getEntitiesOrBuilderList() { 264 return entities_; 265 } 266 /** 267 * 268 * 269 * <pre> 270 * Entities, along with their semantic information, in the input document. 271 * Populated if the user enables 272 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 273 * </pre> 274 * 275 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 276 */ 277 @java.lang.Override getEntitiesCount()278 public int getEntitiesCount() { 279 return entities_.size(); 280 } 281 /** 282 * 283 * 284 * <pre> 285 * Entities, along with their semantic information, in the input document. 286 * Populated if the user enables 287 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 288 * </pre> 289 * 290 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 291 */ 292 @java.lang.Override getEntities(int index)293 public com.google.cloud.language.v1.Entity getEntities(int index) { 294 return entities_.get(index); 295 } 296 /** 297 * 298 * 299 * <pre> 300 * Entities, along with their semantic information, in the input document. 301 * Populated if the user enables 302 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 303 * </pre> 304 * 305 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 306 */ 307 @java.lang.Override getEntitiesOrBuilder(int index)308 public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { 309 return entities_.get(index); 310 } 311 312 public static final int DOCUMENT_SENTIMENT_FIELD_NUMBER = 4; 313 private com.google.cloud.language.v1.Sentiment documentSentiment_; 314 /** 315 * 316 * 317 * <pre> 318 * The overall sentiment for the document. Populated if the user enables 319 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 320 * </pre> 321 * 322 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 323 * 324 * @return Whether the documentSentiment field is set. 325 */ 326 @java.lang.Override hasDocumentSentiment()327 public boolean hasDocumentSentiment() { 328 return documentSentiment_ != null; 329 } 330 /** 331 * 332 * 333 * <pre> 334 * The overall sentiment for the document. Populated if the user enables 335 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 336 * </pre> 337 * 338 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 339 * 340 * @return The documentSentiment. 341 */ 342 @java.lang.Override getDocumentSentiment()343 public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { 344 return documentSentiment_ == null 345 ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() 346 : documentSentiment_; 347 } 348 /** 349 * 350 * 351 * <pre> 352 * The overall sentiment for the document. Populated if the user enables 353 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 354 * </pre> 355 * 356 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 357 */ 358 @java.lang.Override getDocumentSentimentOrBuilder()359 public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { 360 return documentSentiment_ == null 361 ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() 362 : documentSentiment_; 363 } 364 365 public static final int LANGUAGE_FIELD_NUMBER = 5; 366 367 @SuppressWarnings("serial") 368 private volatile java.lang.Object language_ = ""; 369 /** 370 * 371 * 372 * <pre> 373 * The language of the text, which will be the same as the language specified 374 * in the request or, if not specified, the automatically-detected language. 375 * See [Document.language][google.cloud.language.v1.Document.language] field 376 * for more details. 377 * </pre> 378 * 379 * <code>string language = 5;</code> 380 * 381 * @return The language. 382 */ 383 @java.lang.Override getLanguage()384 public java.lang.String getLanguage() { 385 java.lang.Object ref = language_; 386 if (ref instanceof java.lang.String) { 387 return (java.lang.String) ref; 388 } else { 389 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 390 java.lang.String s = bs.toStringUtf8(); 391 language_ = s; 392 return s; 393 } 394 } 395 /** 396 * 397 * 398 * <pre> 399 * The language of the text, which will be the same as the language specified 400 * in the request or, if not specified, the automatically-detected language. 401 * See [Document.language][google.cloud.language.v1.Document.language] field 402 * for more details. 403 * </pre> 404 * 405 * <code>string language = 5;</code> 406 * 407 * @return The bytes for language. 408 */ 409 @java.lang.Override getLanguageBytes()410 public com.google.protobuf.ByteString getLanguageBytes() { 411 java.lang.Object ref = language_; 412 if (ref instanceof java.lang.String) { 413 com.google.protobuf.ByteString b = 414 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 415 language_ = b; 416 return b; 417 } else { 418 return (com.google.protobuf.ByteString) ref; 419 } 420 } 421 422 public static final int CATEGORIES_FIELD_NUMBER = 6; 423 424 @SuppressWarnings("serial") 425 private java.util.List<com.google.cloud.language.v1.ClassificationCategory> categories_; 426 /** 427 * 428 * 429 * <pre> 430 * Categories identified in the input document. 431 * </pre> 432 * 433 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 434 */ 435 @java.lang.Override getCategoriesList()436 public java.util.List<com.google.cloud.language.v1.ClassificationCategory> getCategoriesList() { 437 return categories_; 438 } 439 /** 440 * 441 * 442 * <pre> 443 * Categories identified in the input document. 444 * </pre> 445 * 446 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 447 */ 448 @java.lang.Override 449 public java.util.List<? extends com.google.cloud.language.v1.ClassificationCategoryOrBuilder> getCategoriesOrBuilderList()450 getCategoriesOrBuilderList() { 451 return categories_; 452 } 453 /** 454 * 455 * 456 * <pre> 457 * Categories identified in the input document. 458 * </pre> 459 * 460 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 461 */ 462 @java.lang.Override getCategoriesCount()463 public int getCategoriesCount() { 464 return categories_.size(); 465 } 466 /** 467 * 468 * 469 * <pre> 470 * Categories identified in the input document. 471 * </pre> 472 * 473 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 474 */ 475 @java.lang.Override getCategories(int index)476 public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { 477 return categories_.get(index); 478 } 479 /** 480 * 481 * 482 * <pre> 483 * Categories identified in the input document. 484 * </pre> 485 * 486 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 487 */ 488 @java.lang.Override getCategoriesOrBuilder( int index)489 public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( 490 int index) { 491 return categories_.get(index); 492 } 493 494 private byte memoizedIsInitialized = -1; 495 496 @java.lang.Override isInitialized()497 public final boolean isInitialized() { 498 byte isInitialized = memoizedIsInitialized; 499 if (isInitialized == 1) return true; 500 if (isInitialized == 0) return false; 501 502 memoizedIsInitialized = 1; 503 return true; 504 } 505 506 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)507 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 508 for (int i = 0; i < sentences_.size(); i++) { 509 output.writeMessage(1, sentences_.get(i)); 510 } 511 for (int i = 0; i < tokens_.size(); i++) { 512 output.writeMessage(2, tokens_.get(i)); 513 } 514 for (int i = 0; i < entities_.size(); i++) { 515 output.writeMessage(3, entities_.get(i)); 516 } 517 if (documentSentiment_ != null) { 518 output.writeMessage(4, getDocumentSentiment()); 519 } 520 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { 521 com.google.protobuf.GeneratedMessageV3.writeString(output, 5, language_); 522 } 523 for (int i = 0; i < categories_.size(); i++) { 524 output.writeMessage(6, categories_.get(i)); 525 } 526 getUnknownFields().writeTo(output); 527 } 528 529 @java.lang.Override getSerializedSize()530 public int getSerializedSize() { 531 int size = memoizedSize; 532 if (size != -1) return size; 533 534 size = 0; 535 for (int i = 0; i < sentences_.size(); i++) { 536 size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, sentences_.get(i)); 537 } 538 for (int i = 0; i < tokens_.size(); i++) { 539 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, tokens_.get(i)); 540 } 541 for (int i = 0; i < entities_.size(); i++) { 542 size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, entities_.get(i)); 543 } 544 if (documentSentiment_ != null) { 545 size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getDocumentSentiment()); 546 } 547 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(language_)) { 548 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, language_); 549 } 550 for (int i = 0; i < categories_.size(); i++) { 551 size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, categories_.get(i)); 552 } 553 size += getUnknownFields().getSerializedSize(); 554 memoizedSize = size; 555 return size; 556 } 557 558 @java.lang.Override equals(final java.lang.Object obj)559 public boolean equals(final java.lang.Object obj) { 560 if (obj == this) { 561 return true; 562 } 563 if (!(obj instanceof com.google.cloud.language.v1.AnnotateTextResponse)) { 564 return super.equals(obj); 565 } 566 com.google.cloud.language.v1.AnnotateTextResponse other = 567 (com.google.cloud.language.v1.AnnotateTextResponse) obj; 568 569 if (!getSentencesList().equals(other.getSentencesList())) return false; 570 if (!getTokensList().equals(other.getTokensList())) return false; 571 if (!getEntitiesList().equals(other.getEntitiesList())) return false; 572 if (hasDocumentSentiment() != other.hasDocumentSentiment()) return false; 573 if (hasDocumentSentiment()) { 574 if (!getDocumentSentiment().equals(other.getDocumentSentiment())) return false; 575 } 576 if (!getLanguage().equals(other.getLanguage())) return false; 577 if (!getCategoriesList().equals(other.getCategoriesList())) return false; 578 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 579 return true; 580 } 581 582 @java.lang.Override hashCode()583 public int hashCode() { 584 if (memoizedHashCode != 0) { 585 return memoizedHashCode; 586 } 587 int hash = 41; 588 hash = (19 * hash) + getDescriptor().hashCode(); 589 if (getSentencesCount() > 0) { 590 hash = (37 * hash) + SENTENCES_FIELD_NUMBER; 591 hash = (53 * hash) + getSentencesList().hashCode(); 592 } 593 if (getTokensCount() > 0) { 594 hash = (37 * hash) + TOKENS_FIELD_NUMBER; 595 hash = (53 * hash) + getTokensList().hashCode(); 596 } 597 if (getEntitiesCount() > 0) { 598 hash = (37 * hash) + ENTITIES_FIELD_NUMBER; 599 hash = (53 * hash) + getEntitiesList().hashCode(); 600 } 601 if (hasDocumentSentiment()) { 602 hash = (37 * hash) + DOCUMENT_SENTIMENT_FIELD_NUMBER; 603 hash = (53 * hash) + getDocumentSentiment().hashCode(); 604 } 605 hash = (37 * hash) + LANGUAGE_FIELD_NUMBER; 606 hash = (53 * hash) + getLanguage().hashCode(); 607 if (getCategoriesCount() > 0) { 608 hash = (37 * hash) + CATEGORIES_FIELD_NUMBER; 609 hash = (53 * hash) + getCategoriesList().hashCode(); 610 } 611 hash = (29 * hash) + getUnknownFields().hashCode(); 612 memoizedHashCode = hash; 613 return hash; 614 } 615 parseFrom( java.nio.ByteBuffer data)616 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 617 java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { 618 return PARSER.parseFrom(data); 619 } 620 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)621 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 622 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 623 throws com.google.protobuf.InvalidProtocolBufferException { 624 return PARSER.parseFrom(data, extensionRegistry); 625 } 626 parseFrom( com.google.protobuf.ByteString data)627 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 628 com.google.protobuf.ByteString data) 629 throws com.google.protobuf.InvalidProtocolBufferException { 630 return PARSER.parseFrom(data); 631 } 632 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)633 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 634 com.google.protobuf.ByteString data, 635 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 636 throws com.google.protobuf.InvalidProtocolBufferException { 637 return PARSER.parseFrom(data, extensionRegistry); 638 } 639 parseFrom(byte[] data)640 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom(byte[] data) 641 throws com.google.protobuf.InvalidProtocolBufferException { 642 return PARSER.parseFrom(data); 643 } 644 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)645 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 646 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 647 throws com.google.protobuf.InvalidProtocolBufferException { 648 return PARSER.parseFrom(data, extensionRegistry); 649 } 650 parseFrom( java.io.InputStream input)651 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 652 java.io.InputStream input) throws java.io.IOException { 653 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 654 } 655 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)656 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 657 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 658 throws java.io.IOException { 659 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 660 PARSER, input, extensionRegistry); 661 } 662 parseDelimitedFrom( java.io.InputStream input)663 public static com.google.cloud.language.v1.AnnotateTextResponse parseDelimitedFrom( 664 java.io.InputStream input) throws java.io.IOException { 665 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 666 } 667 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)668 public static com.google.cloud.language.v1.AnnotateTextResponse parseDelimitedFrom( 669 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 670 throws java.io.IOException { 671 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 672 PARSER, input, extensionRegistry); 673 } 674 parseFrom( com.google.protobuf.CodedInputStream input)675 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 676 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 677 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 678 } 679 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)680 public static com.google.cloud.language.v1.AnnotateTextResponse parseFrom( 681 com.google.protobuf.CodedInputStream input, 682 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 683 throws java.io.IOException { 684 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 685 PARSER, input, extensionRegistry); 686 } 687 688 @java.lang.Override newBuilderForType()689 public Builder newBuilderForType() { 690 return newBuilder(); 691 } 692 newBuilder()693 public static Builder newBuilder() { 694 return DEFAULT_INSTANCE.toBuilder(); 695 } 696 newBuilder(com.google.cloud.language.v1.AnnotateTextResponse prototype)697 public static Builder newBuilder(com.google.cloud.language.v1.AnnotateTextResponse prototype) { 698 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 699 } 700 701 @java.lang.Override toBuilder()702 public Builder toBuilder() { 703 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 704 } 705 706 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)707 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 708 Builder builder = new Builder(parent); 709 return builder; 710 } 711 /** 712 * 713 * 714 * <pre> 715 * The text annotations response message. 716 * </pre> 717 * 718 * Protobuf type {@code google.cloud.language.v1.AnnotateTextResponse} 719 */ 720 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 721 implements 722 // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.AnnotateTextResponse) 723 com.google.cloud.language.v1.AnnotateTextResponseOrBuilder { getDescriptor()724 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 725 return com.google.cloud.language.v1.LanguageServiceProto 726 .internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; 727 } 728 729 @java.lang.Override 730 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()731 internalGetFieldAccessorTable() { 732 return com.google.cloud.language.v1.LanguageServiceProto 733 .internal_static_google_cloud_language_v1_AnnotateTextResponse_fieldAccessorTable 734 .ensureFieldAccessorsInitialized( 735 com.google.cloud.language.v1.AnnotateTextResponse.class, 736 com.google.cloud.language.v1.AnnotateTextResponse.Builder.class); 737 } 738 739 // Construct using com.google.cloud.language.v1.AnnotateTextResponse.newBuilder() Builder()740 private Builder() {} 741 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)742 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 743 super(parent); 744 } 745 746 @java.lang.Override clear()747 public Builder clear() { 748 super.clear(); 749 bitField0_ = 0; 750 if (sentencesBuilder_ == null) { 751 sentences_ = java.util.Collections.emptyList(); 752 } else { 753 sentences_ = null; 754 sentencesBuilder_.clear(); 755 } 756 bitField0_ = (bitField0_ & ~0x00000001); 757 if (tokensBuilder_ == null) { 758 tokens_ = java.util.Collections.emptyList(); 759 } else { 760 tokens_ = null; 761 tokensBuilder_.clear(); 762 } 763 bitField0_ = (bitField0_ & ~0x00000002); 764 if (entitiesBuilder_ == null) { 765 entities_ = java.util.Collections.emptyList(); 766 } else { 767 entities_ = null; 768 entitiesBuilder_.clear(); 769 } 770 bitField0_ = (bitField0_ & ~0x00000004); 771 documentSentiment_ = null; 772 if (documentSentimentBuilder_ != null) { 773 documentSentimentBuilder_.dispose(); 774 documentSentimentBuilder_ = null; 775 } 776 language_ = ""; 777 if (categoriesBuilder_ == null) { 778 categories_ = java.util.Collections.emptyList(); 779 } else { 780 categories_ = null; 781 categoriesBuilder_.clear(); 782 } 783 bitField0_ = (bitField0_ & ~0x00000020); 784 return this; 785 } 786 787 @java.lang.Override getDescriptorForType()788 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 789 return com.google.cloud.language.v1.LanguageServiceProto 790 .internal_static_google_cloud_language_v1_AnnotateTextResponse_descriptor; 791 } 792 793 @java.lang.Override getDefaultInstanceForType()794 public com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstanceForType() { 795 return com.google.cloud.language.v1.AnnotateTextResponse.getDefaultInstance(); 796 } 797 798 @java.lang.Override build()799 public com.google.cloud.language.v1.AnnotateTextResponse build() { 800 com.google.cloud.language.v1.AnnotateTextResponse result = buildPartial(); 801 if (!result.isInitialized()) { 802 throw newUninitializedMessageException(result); 803 } 804 return result; 805 } 806 807 @java.lang.Override buildPartial()808 public com.google.cloud.language.v1.AnnotateTextResponse buildPartial() { 809 com.google.cloud.language.v1.AnnotateTextResponse result = 810 new com.google.cloud.language.v1.AnnotateTextResponse(this); 811 buildPartialRepeatedFields(result); 812 if (bitField0_ != 0) { 813 buildPartial0(result); 814 } 815 onBuilt(); 816 return result; 817 } 818 buildPartialRepeatedFields( com.google.cloud.language.v1.AnnotateTextResponse result)819 private void buildPartialRepeatedFields( 820 com.google.cloud.language.v1.AnnotateTextResponse result) { 821 if (sentencesBuilder_ == null) { 822 if (((bitField0_ & 0x00000001) != 0)) { 823 sentences_ = java.util.Collections.unmodifiableList(sentences_); 824 bitField0_ = (bitField0_ & ~0x00000001); 825 } 826 result.sentences_ = sentences_; 827 } else { 828 result.sentences_ = sentencesBuilder_.build(); 829 } 830 if (tokensBuilder_ == null) { 831 if (((bitField0_ & 0x00000002) != 0)) { 832 tokens_ = java.util.Collections.unmodifiableList(tokens_); 833 bitField0_ = (bitField0_ & ~0x00000002); 834 } 835 result.tokens_ = tokens_; 836 } else { 837 result.tokens_ = tokensBuilder_.build(); 838 } 839 if (entitiesBuilder_ == null) { 840 if (((bitField0_ & 0x00000004) != 0)) { 841 entities_ = java.util.Collections.unmodifiableList(entities_); 842 bitField0_ = (bitField0_ & ~0x00000004); 843 } 844 result.entities_ = entities_; 845 } else { 846 result.entities_ = entitiesBuilder_.build(); 847 } 848 if (categoriesBuilder_ == null) { 849 if (((bitField0_ & 0x00000020) != 0)) { 850 categories_ = java.util.Collections.unmodifiableList(categories_); 851 bitField0_ = (bitField0_ & ~0x00000020); 852 } 853 result.categories_ = categories_; 854 } else { 855 result.categories_ = categoriesBuilder_.build(); 856 } 857 } 858 buildPartial0(com.google.cloud.language.v1.AnnotateTextResponse result)859 private void buildPartial0(com.google.cloud.language.v1.AnnotateTextResponse result) { 860 int from_bitField0_ = bitField0_; 861 if (((from_bitField0_ & 0x00000008) != 0)) { 862 result.documentSentiment_ = 863 documentSentimentBuilder_ == null 864 ? documentSentiment_ 865 : documentSentimentBuilder_.build(); 866 } 867 if (((from_bitField0_ & 0x00000010) != 0)) { 868 result.language_ = language_; 869 } 870 } 871 872 @java.lang.Override clone()873 public Builder clone() { 874 return super.clone(); 875 } 876 877 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)878 public Builder setField( 879 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 880 return super.setField(field, value); 881 } 882 883 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)884 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 885 return super.clearField(field); 886 } 887 888 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)889 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 890 return super.clearOneof(oneof); 891 } 892 893 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)894 public Builder setRepeatedField( 895 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 896 return super.setRepeatedField(field, index, value); 897 } 898 899 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)900 public Builder addRepeatedField( 901 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 902 return super.addRepeatedField(field, value); 903 } 904 905 @java.lang.Override mergeFrom(com.google.protobuf.Message other)906 public Builder mergeFrom(com.google.protobuf.Message other) { 907 if (other instanceof com.google.cloud.language.v1.AnnotateTextResponse) { 908 return mergeFrom((com.google.cloud.language.v1.AnnotateTextResponse) other); 909 } else { 910 super.mergeFrom(other); 911 return this; 912 } 913 } 914 mergeFrom(com.google.cloud.language.v1.AnnotateTextResponse other)915 public Builder mergeFrom(com.google.cloud.language.v1.AnnotateTextResponse other) { 916 if (other == com.google.cloud.language.v1.AnnotateTextResponse.getDefaultInstance()) 917 return this; 918 if (sentencesBuilder_ == null) { 919 if (!other.sentences_.isEmpty()) { 920 if (sentences_.isEmpty()) { 921 sentences_ = other.sentences_; 922 bitField0_ = (bitField0_ & ~0x00000001); 923 } else { 924 ensureSentencesIsMutable(); 925 sentences_.addAll(other.sentences_); 926 } 927 onChanged(); 928 } 929 } else { 930 if (!other.sentences_.isEmpty()) { 931 if (sentencesBuilder_.isEmpty()) { 932 sentencesBuilder_.dispose(); 933 sentencesBuilder_ = null; 934 sentences_ = other.sentences_; 935 bitField0_ = (bitField0_ & ~0x00000001); 936 sentencesBuilder_ = 937 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 938 ? getSentencesFieldBuilder() 939 : null; 940 } else { 941 sentencesBuilder_.addAllMessages(other.sentences_); 942 } 943 } 944 } 945 if (tokensBuilder_ == null) { 946 if (!other.tokens_.isEmpty()) { 947 if (tokens_.isEmpty()) { 948 tokens_ = other.tokens_; 949 bitField0_ = (bitField0_ & ~0x00000002); 950 } else { 951 ensureTokensIsMutable(); 952 tokens_.addAll(other.tokens_); 953 } 954 onChanged(); 955 } 956 } else { 957 if (!other.tokens_.isEmpty()) { 958 if (tokensBuilder_.isEmpty()) { 959 tokensBuilder_.dispose(); 960 tokensBuilder_ = null; 961 tokens_ = other.tokens_; 962 bitField0_ = (bitField0_ & ~0x00000002); 963 tokensBuilder_ = 964 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 965 ? getTokensFieldBuilder() 966 : null; 967 } else { 968 tokensBuilder_.addAllMessages(other.tokens_); 969 } 970 } 971 } 972 if (entitiesBuilder_ == null) { 973 if (!other.entities_.isEmpty()) { 974 if (entities_.isEmpty()) { 975 entities_ = other.entities_; 976 bitField0_ = (bitField0_ & ~0x00000004); 977 } else { 978 ensureEntitiesIsMutable(); 979 entities_.addAll(other.entities_); 980 } 981 onChanged(); 982 } 983 } else { 984 if (!other.entities_.isEmpty()) { 985 if (entitiesBuilder_.isEmpty()) { 986 entitiesBuilder_.dispose(); 987 entitiesBuilder_ = null; 988 entities_ = other.entities_; 989 bitField0_ = (bitField0_ & ~0x00000004); 990 entitiesBuilder_ = 991 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 992 ? getEntitiesFieldBuilder() 993 : null; 994 } else { 995 entitiesBuilder_.addAllMessages(other.entities_); 996 } 997 } 998 } 999 if (other.hasDocumentSentiment()) { 1000 mergeDocumentSentiment(other.getDocumentSentiment()); 1001 } 1002 if (!other.getLanguage().isEmpty()) { 1003 language_ = other.language_; 1004 bitField0_ |= 0x00000010; 1005 onChanged(); 1006 } 1007 if (categoriesBuilder_ == null) { 1008 if (!other.categories_.isEmpty()) { 1009 if (categories_.isEmpty()) { 1010 categories_ = other.categories_; 1011 bitField0_ = (bitField0_ & ~0x00000020); 1012 } else { 1013 ensureCategoriesIsMutable(); 1014 categories_.addAll(other.categories_); 1015 } 1016 onChanged(); 1017 } 1018 } else { 1019 if (!other.categories_.isEmpty()) { 1020 if (categoriesBuilder_.isEmpty()) { 1021 categoriesBuilder_.dispose(); 1022 categoriesBuilder_ = null; 1023 categories_ = other.categories_; 1024 bitField0_ = (bitField0_ & ~0x00000020); 1025 categoriesBuilder_ = 1026 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 1027 ? getCategoriesFieldBuilder() 1028 : null; 1029 } else { 1030 categoriesBuilder_.addAllMessages(other.categories_); 1031 } 1032 } 1033 } 1034 this.mergeUnknownFields(other.getUnknownFields()); 1035 onChanged(); 1036 return this; 1037 } 1038 1039 @java.lang.Override isInitialized()1040 public final boolean isInitialized() { 1041 return true; 1042 } 1043 1044 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1045 public Builder mergeFrom( 1046 com.google.protobuf.CodedInputStream input, 1047 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1048 throws java.io.IOException { 1049 if (extensionRegistry == null) { 1050 throw new java.lang.NullPointerException(); 1051 } 1052 try { 1053 boolean done = false; 1054 while (!done) { 1055 int tag = input.readTag(); 1056 switch (tag) { 1057 case 0: 1058 done = true; 1059 break; 1060 case 10: 1061 { 1062 com.google.cloud.language.v1.Sentence m = 1063 input.readMessage( 1064 com.google.cloud.language.v1.Sentence.parser(), extensionRegistry); 1065 if (sentencesBuilder_ == null) { 1066 ensureSentencesIsMutable(); 1067 sentences_.add(m); 1068 } else { 1069 sentencesBuilder_.addMessage(m); 1070 } 1071 break; 1072 } // case 10 1073 case 18: 1074 { 1075 com.google.cloud.language.v1.Token m = 1076 input.readMessage( 1077 com.google.cloud.language.v1.Token.parser(), extensionRegistry); 1078 if (tokensBuilder_ == null) { 1079 ensureTokensIsMutable(); 1080 tokens_.add(m); 1081 } else { 1082 tokensBuilder_.addMessage(m); 1083 } 1084 break; 1085 } // case 18 1086 case 26: 1087 { 1088 com.google.cloud.language.v1.Entity m = 1089 input.readMessage( 1090 com.google.cloud.language.v1.Entity.parser(), extensionRegistry); 1091 if (entitiesBuilder_ == null) { 1092 ensureEntitiesIsMutable(); 1093 entities_.add(m); 1094 } else { 1095 entitiesBuilder_.addMessage(m); 1096 } 1097 break; 1098 } // case 26 1099 case 34: 1100 { 1101 input.readMessage( 1102 getDocumentSentimentFieldBuilder().getBuilder(), extensionRegistry); 1103 bitField0_ |= 0x00000008; 1104 break; 1105 } // case 34 1106 case 42: 1107 { 1108 language_ = input.readStringRequireUtf8(); 1109 bitField0_ |= 0x00000010; 1110 break; 1111 } // case 42 1112 case 50: 1113 { 1114 com.google.cloud.language.v1.ClassificationCategory m = 1115 input.readMessage( 1116 com.google.cloud.language.v1.ClassificationCategory.parser(), 1117 extensionRegistry); 1118 if (categoriesBuilder_ == null) { 1119 ensureCategoriesIsMutable(); 1120 categories_.add(m); 1121 } else { 1122 categoriesBuilder_.addMessage(m); 1123 } 1124 break; 1125 } // case 50 1126 default: 1127 { 1128 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 1129 done = true; // was an endgroup tag 1130 } 1131 break; 1132 } // default: 1133 } // switch (tag) 1134 } // while (!done) 1135 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1136 throw e.unwrapIOException(); 1137 } finally { 1138 onChanged(); 1139 } // finally 1140 return this; 1141 } 1142 1143 private int bitField0_; 1144 1145 private java.util.List<com.google.cloud.language.v1.Sentence> sentences_ = 1146 java.util.Collections.emptyList(); 1147 ensureSentencesIsMutable()1148 private void ensureSentencesIsMutable() { 1149 if (!((bitField0_ & 0x00000001) != 0)) { 1150 sentences_ = new java.util.ArrayList<com.google.cloud.language.v1.Sentence>(sentences_); 1151 bitField0_ |= 0x00000001; 1152 } 1153 } 1154 1155 private com.google.protobuf.RepeatedFieldBuilderV3< 1156 com.google.cloud.language.v1.Sentence, 1157 com.google.cloud.language.v1.Sentence.Builder, 1158 com.google.cloud.language.v1.SentenceOrBuilder> 1159 sentencesBuilder_; 1160 1161 /** 1162 * 1163 * 1164 * <pre> 1165 * Sentences in the input document. Populated if the user enables 1166 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1167 * </pre> 1168 * 1169 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1170 */ getSentencesList()1171 public java.util.List<com.google.cloud.language.v1.Sentence> getSentencesList() { 1172 if (sentencesBuilder_ == null) { 1173 return java.util.Collections.unmodifiableList(sentences_); 1174 } else { 1175 return sentencesBuilder_.getMessageList(); 1176 } 1177 } 1178 /** 1179 * 1180 * 1181 * <pre> 1182 * Sentences in the input document. Populated if the user enables 1183 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1184 * </pre> 1185 * 1186 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1187 */ getSentencesCount()1188 public int getSentencesCount() { 1189 if (sentencesBuilder_ == null) { 1190 return sentences_.size(); 1191 } else { 1192 return sentencesBuilder_.getCount(); 1193 } 1194 } 1195 /** 1196 * 1197 * 1198 * <pre> 1199 * Sentences in the input document. Populated if the user enables 1200 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1201 * </pre> 1202 * 1203 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1204 */ getSentences(int index)1205 public com.google.cloud.language.v1.Sentence getSentences(int index) { 1206 if (sentencesBuilder_ == null) { 1207 return sentences_.get(index); 1208 } else { 1209 return sentencesBuilder_.getMessage(index); 1210 } 1211 } 1212 /** 1213 * 1214 * 1215 * <pre> 1216 * Sentences in the input document. Populated if the user enables 1217 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1218 * </pre> 1219 * 1220 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1221 */ setSentences(int index, com.google.cloud.language.v1.Sentence value)1222 public Builder setSentences(int index, com.google.cloud.language.v1.Sentence value) { 1223 if (sentencesBuilder_ == null) { 1224 if (value == null) { 1225 throw new NullPointerException(); 1226 } 1227 ensureSentencesIsMutable(); 1228 sentences_.set(index, value); 1229 onChanged(); 1230 } else { 1231 sentencesBuilder_.setMessage(index, value); 1232 } 1233 return this; 1234 } 1235 /** 1236 * 1237 * 1238 * <pre> 1239 * Sentences in the input document. Populated if the user enables 1240 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1241 * </pre> 1242 * 1243 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1244 */ setSentences( int index, com.google.cloud.language.v1.Sentence.Builder builderForValue)1245 public Builder setSentences( 1246 int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { 1247 if (sentencesBuilder_ == null) { 1248 ensureSentencesIsMutable(); 1249 sentences_.set(index, builderForValue.build()); 1250 onChanged(); 1251 } else { 1252 sentencesBuilder_.setMessage(index, builderForValue.build()); 1253 } 1254 return this; 1255 } 1256 /** 1257 * 1258 * 1259 * <pre> 1260 * Sentences in the input document. Populated if the user enables 1261 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1262 * </pre> 1263 * 1264 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1265 */ addSentences(com.google.cloud.language.v1.Sentence value)1266 public Builder addSentences(com.google.cloud.language.v1.Sentence value) { 1267 if (sentencesBuilder_ == null) { 1268 if (value == null) { 1269 throw new NullPointerException(); 1270 } 1271 ensureSentencesIsMutable(); 1272 sentences_.add(value); 1273 onChanged(); 1274 } else { 1275 sentencesBuilder_.addMessage(value); 1276 } 1277 return this; 1278 } 1279 /** 1280 * 1281 * 1282 * <pre> 1283 * Sentences in the input document. Populated if the user enables 1284 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1285 * </pre> 1286 * 1287 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1288 */ addSentences(int index, com.google.cloud.language.v1.Sentence value)1289 public Builder addSentences(int index, com.google.cloud.language.v1.Sentence value) { 1290 if (sentencesBuilder_ == null) { 1291 if (value == null) { 1292 throw new NullPointerException(); 1293 } 1294 ensureSentencesIsMutable(); 1295 sentences_.add(index, value); 1296 onChanged(); 1297 } else { 1298 sentencesBuilder_.addMessage(index, value); 1299 } 1300 return this; 1301 } 1302 /** 1303 * 1304 * 1305 * <pre> 1306 * Sentences in the input document. Populated if the user enables 1307 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1308 * </pre> 1309 * 1310 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1311 */ addSentences(com.google.cloud.language.v1.Sentence.Builder builderForValue)1312 public Builder addSentences(com.google.cloud.language.v1.Sentence.Builder builderForValue) { 1313 if (sentencesBuilder_ == null) { 1314 ensureSentencesIsMutable(); 1315 sentences_.add(builderForValue.build()); 1316 onChanged(); 1317 } else { 1318 sentencesBuilder_.addMessage(builderForValue.build()); 1319 } 1320 return this; 1321 } 1322 /** 1323 * 1324 * 1325 * <pre> 1326 * Sentences in the input document. Populated if the user enables 1327 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1328 * </pre> 1329 * 1330 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1331 */ addSentences( int index, com.google.cloud.language.v1.Sentence.Builder builderForValue)1332 public Builder addSentences( 1333 int index, com.google.cloud.language.v1.Sentence.Builder builderForValue) { 1334 if (sentencesBuilder_ == null) { 1335 ensureSentencesIsMutable(); 1336 sentences_.add(index, builderForValue.build()); 1337 onChanged(); 1338 } else { 1339 sentencesBuilder_.addMessage(index, builderForValue.build()); 1340 } 1341 return this; 1342 } 1343 /** 1344 * 1345 * 1346 * <pre> 1347 * Sentences in the input document. Populated if the user enables 1348 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1349 * </pre> 1350 * 1351 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1352 */ addAllSentences( java.lang.Iterable<? extends com.google.cloud.language.v1.Sentence> values)1353 public Builder addAllSentences( 1354 java.lang.Iterable<? extends com.google.cloud.language.v1.Sentence> values) { 1355 if (sentencesBuilder_ == null) { 1356 ensureSentencesIsMutable(); 1357 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, sentences_); 1358 onChanged(); 1359 } else { 1360 sentencesBuilder_.addAllMessages(values); 1361 } 1362 return this; 1363 } 1364 /** 1365 * 1366 * 1367 * <pre> 1368 * Sentences in the input document. Populated if the user enables 1369 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1370 * </pre> 1371 * 1372 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1373 */ clearSentences()1374 public Builder clearSentences() { 1375 if (sentencesBuilder_ == null) { 1376 sentences_ = java.util.Collections.emptyList(); 1377 bitField0_ = (bitField0_ & ~0x00000001); 1378 onChanged(); 1379 } else { 1380 sentencesBuilder_.clear(); 1381 } 1382 return this; 1383 } 1384 /** 1385 * 1386 * 1387 * <pre> 1388 * Sentences in the input document. Populated if the user enables 1389 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1390 * </pre> 1391 * 1392 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1393 */ removeSentences(int index)1394 public Builder removeSentences(int index) { 1395 if (sentencesBuilder_ == null) { 1396 ensureSentencesIsMutable(); 1397 sentences_.remove(index); 1398 onChanged(); 1399 } else { 1400 sentencesBuilder_.remove(index); 1401 } 1402 return this; 1403 } 1404 /** 1405 * 1406 * 1407 * <pre> 1408 * Sentences in the input document. Populated if the user enables 1409 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1410 * </pre> 1411 * 1412 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1413 */ getSentencesBuilder(int index)1414 public com.google.cloud.language.v1.Sentence.Builder getSentencesBuilder(int index) { 1415 return getSentencesFieldBuilder().getBuilder(index); 1416 } 1417 /** 1418 * 1419 * 1420 * <pre> 1421 * Sentences in the input document. Populated if the user enables 1422 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1423 * </pre> 1424 * 1425 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1426 */ getSentencesOrBuilder(int index)1427 public com.google.cloud.language.v1.SentenceOrBuilder getSentencesOrBuilder(int index) { 1428 if (sentencesBuilder_ == null) { 1429 return sentences_.get(index); 1430 } else { 1431 return sentencesBuilder_.getMessageOrBuilder(index); 1432 } 1433 } 1434 /** 1435 * 1436 * 1437 * <pre> 1438 * Sentences in the input document. Populated if the user enables 1439 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1440 * </pre> 1441 * 1442 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1443 */ 1444 public java.util.List<? extends com.google.cloud.language.v1.SentenceOrBuilder> getSentencesOrBuilderList()1445 getSentencesOrBuilderList() { 1446 if (sentencesBuilder_ != null) { 1447 return sentencesBuilder_.getMessageOrBuilderList(); 1448 } else { 1449 return java.util.Collections.unmodifiableList(sentences_); 1450 } 1451 } 1452 /** 1453 * 1454 * 1455 * <pre> 1456 * Sentences in the input document. Populated if the user enables 1457 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1458 * </pre> 1459 * 1460 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1461 */ addSentencesBuilder()1462 public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder() { 1463 return getSentencesFieldBuilder() 1464 .addBuilder(com.google.cloud.language.v1.Sentence.getDefaultInstance()); 1465 } 1466 /** 1467 * 1468 * 1469 * <pre> 1470 * Sentences in the input document. Populated if the user enables 1471 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1472 * </pre> 1473 * 1474 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1475 */ addSentencesBuilder(int index)1476 public com.google.cloud.language.v1.Sentence.Builder addSentencesBuilder(int index) { 1477 return getSentencesFieldBuilder() 1478 .addBuilder(index, com.google.cloud.language.v1.Sentence.getDefaultInstance()); 1479 } 1480 /** 1481 * 1482 * 1483 * <pre> 1484 * Sentences in the input document. Populated if the user enables 1485 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1486 * </pre> 1487 * 1488 * <code>repeated .google.cloud.language.v1.Sentence sentences = 1;</code> 1489 */ getSentencesBuilderList()1490 public java.util.List<com.google.cloud.language.v1.Sentence.Builder> getSentencesBuilderList() { 1491 return getSentencesFieldBuilder().getBuilderList(); 1492 } 1493 1494 private com.google.protobuf.RepeatedFieldBuilderV3< 1495 com.google.cloud.language.v1.Sentence, 1496 com.google.cloud.language.v1.Sentence.Builder, 1497 com.google.cloud.language.v1.SentenceOrBuilder> getSentencesFieldBuilder()1498 getSentencesFieldBuilder() { 1499 if (sentencesBuilder_ == null) { 1500 sentencesBuilder_ = 1501 new com.google.protobuf.RepeatedFieldBuilderV3< 1502 com.google.cloud.language.v1.Sentence, 1503 com.google.cloud.language.v1.Sentence.Builder, 1504 com.google.cloud.language.v1.SentenceOrBuilder>( 1505 sentences_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); 1506 sentences_ = null; 1507 } 1508 return sentencesBuilder_; 1509 } 1510 1511 private java.util.List<com.google.cloud.language.v1.Token> tokens_ = 1512 java.util.Collections.emptyList(); 1513 ensureTokensIsMutable()1514 private void ensureTokensIsMutable() { 1515 if (!((bitField0_ & 0x00000002) != 0)) { 1516 tokens_ = new java.util.ArrayList<com.google.cloud.language.v1.Token>(tokens_); 1517 bitField0_ |= 0x00000002; 1518 } 1519 } 1520 1521 private com.google.protobuf.RepeatedFieldBuilderV3< 1522 com.google.cloud.language.v1.Token, 1523 com.google.cloud.language.v1.Token.Builder, 1524 com.google.cloud.language.v1.TokenOrBuilder> 1525 tokensBuilder_; 1526 1527 /** 1528 * 1529 * 1530 * <pre> 1531 * Tokens, along with their syntactic information, in the input document. 1532 * Populated if the user enables 1533 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1534 * </pre> 1535 * 1536 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1537 */ getTokensList()1538 public java.util.List<com.google.cloud.language.v1.Token> getTokensList() { 1539 if (tokensBuilder_ == null) { 1540 return java.util.Collections.unmodifiableList(tokens_); 1541 } else { 1542 return tokensBuilder_.getMessageList(); 1543 } 1544 } 1545 /** 1546 * 1547 * 1548 * <pre> 1549 * Tokens, along with their syntactic information, in the input document. 1550 * Populated if the user enables 1551 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1552 * </pre> 1553 * 1554 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1555 */ getTokensCount()1556 public int getTokensCount() { 1557 if (tokensBuilder_ == null) { 1558 return tokens_.size(); 1559 } else { 1560 return tokensBuilder_.getCount(); 1561 } 1562 } 1563 /** 1564 * 1565 * 1566 * <pre> 1567 * Tokens, along with their syntactic information, in the input document. 1568 * Populated if the user enables 1569 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1570 * </pre> 1571 * 1572 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1573 */ getTokens(int index)1574 public com.google.cloud.language.v1.Token getTokens(int index) { 1575 if (tokensBuilder_ == null) { 1576 return tokens_.get(index); 1577 } else { 1578 return tokensBuilder_.getMessage(index); 1579 } 1580 } 1581 /** 1582 * 1583 * 1584 * <pre> 1585 * Tokens, along with their syntactic information, in the input document. 1586 * Populated if the user enables 1587 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1588 * </pre> 1589 * 1590 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1591 */ setTokens(int index, com.google.cloud.language.v1.Token value)1592 public Builder setTokens(int index, com.google.cloud.language.v1.Token value) { 1593 if (tokensBuilder_ == null) { 1594 if (value == null) { 1595 throw new NullPointerException(); 1596 } 1597 ensureTokensIsMutable(); 1598 tokens_.set(index, value); 1599 onChanged(); 1600 } else { 1601 tokensBuilder_.setMessage(index, value); 1602 } 1603 return this; 1604 } 1605 /** 1606 * 1607 * 1608 * <pre> 1609 * Tokens, along with their syntactic information, in the input document. 1610 * Populated if the user enables 1611 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1612 * </pre> 1613 * 1614 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1615 */ setTokens( int index, com.google.cloud.language.v1.Token.Builder builderForValue)1616 public Builder setTokens( 1617 int index, com.google.cloud.language.v1.Token.Builder builderForValue) { 1618 if (tokensBuilder_ == null) { 1619 ensureTokensIsMutable(); 1620 tokens_.set(index, builderForValue.build()); 1621 onChanged(); 1622 } else { 1623 tokensBuilder_.setMessage(index, builderForValue.build()); 1624 } 1625 return this; 1626 } 1627 /** 1628 * 1629 * 1630 * <pre> 1631 * Tokens, along with their syntactic information, in the input document. 1632 * Populated if the user enables 1633 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1634 * </pre> 1635 * 1636 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1637 */ addTokens(com.google.cloud.language.v1.Token value)1638 public Builder addTokens(com.google.cloud.language.v1.Token value) { 1639 if (tokensBuilder_ == null) { 1640 if (value == null) { 1641 throw new NullPointerException(); 1642 } 1643 ensureTokensIsMutable(); 1644 tokens_.add(value); 1645 onChanged(); 1646 } else { 1647 tokensBuilder_.addMessage(value); 1648 } 1649 return this; 1650 } 1651 /** 1652 * 1653 * 1654 * <pre> 1655 * Tokens, along with their syntactic information, in the input document. 1656 * Populated if the user enables 1657 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1658 * </pre> 1659 * 1660 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1661 */ addTokens(int index, com.google.cloud.language.v1.Token value)1662 public Builder addTokens(int index, com.google.cloud.language.v1.Token value) { 1663 if (tokensBuilder_ == null) { 1664 if (value == null) { 1665 throw new NullPointerException(); 1666 } 1667 ensureTokensIsMutable(); 1668 tokens_.add(index, value); 1669 onChanged(); 1670 } else { 1671 tokensBuilder_.addMessage(index, value); 1672 } 1673 return this; 1674 } 1675 /** 1676 * 1677 * 1678 * <pre> 1679 * Tokens, along with their syntactic information, in the input document. 1680 * Populated if the user enables 1681 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1682 * </pre> 1683 * 1684 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1685 */ addTokens(com.google.cloud.language.v1.Token.Builder builderForValue)1686 public Builder addTokens(com.google.cloud.language.v1.Token.Builder builderForValue) { 1687 if (tokensBuilder_ == null) { 1688 ensureTokensIsMutable(); 1689 tokens_.add(builderForValue.build()); 1690 onChanged(); 1691 } else { 1692 tokensBuilder_.addMessage(builderForValue.build()); 1693 } 1694 return this; 1695 } 1696 /** 1697 * 1698 * 1699 * <pre> 1700 * Tokens, along with their syntactic information, in the input document. 1701 * Populated if the user enables 1702 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1703 * </pre> 1704 * 1705 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1706 */ addTokens( int index, com.google.cloud.language.v1.Token.Builder builderForValue)1707 public Builder addTokens( 1708 int index, com.google.cloud.language.v1.Token.Builder builderForValue) { 1709 if (tokensBuilder_ == null) { 1710 ensureTokensIsMutable(); 1711 tokens_.add(index, builderForValue.build()); 1712 onChanged(); 1713 } else { 1714 tokensBuilder_.addMessage(index, builderForValue.build()); 1715 } 1716 return this; 1717 } 1718 /** 1719 * 1720 * 1721 * <pre> 1722 * Tokens, along with their syntactic information, in the input document. 1723 * Populated if the user enables 1724 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1725 * </pre> 1726 * 1727 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1728 */ addAllTokens( java.lang.Iterable<? extends com.google.cloud.language.v1.Token> values)1729 public Builder addAllTokens( 1730 java.lang.Iterable<? extends com.google.cloud.language.v1.Token> values) { 1731 if (tokensBuilder_ == null) { 1732 ensureTokensIsMutable(); 1733 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, tokens_); 1734 onChanged(); 1735 } else { 1736 tokensBuilder_.addAllMessages(values); 1737 } 1738 return this; 1739 } 1740 /** 1741 * 1742 * 1743 * <pre> 1744 * Tokens, along with their syntactic information, in the input document. 1745 * Populated if the user enables 1746 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1747 * </pre> 1748 * 1749 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1750 */ clearTokens()1751 public Builder clearTokens() { 1752 if (tokensBuilder_ == null) { 1753 tokens_ = java.util.Collections.emptyList(); 1754 bitField0_ = (bitField0_ & ~0x00000002); 1755 onChanged(); 1756 } else { 1757 tokensBuilder_.clear(); 1758 } 1759 return this; 1760 } 1761 /** 1762 * 1763 * 1764 * <pre> 1765 * Tokens, along with their syntactic information, in the input document. 1766 * Populated if the user enables 1767 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1768 * </pre> 1769 * 1770 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1771 */ removeTokens(int index)1772 public Builder removeTokens(int index) { 1773 if (tokensBuilder_ == null) { 1774 ensureTokensIsMutable(); 1775 tokens_.remove(index); 1776 onChanged(); 1777 } else { 1778 tokensBuilder_.remove(index); 1779 } 1780 return this; 1781 } 1782 /** 1783 * 1784 * 1785 * <pre> 1786 * Tokens, along with their syntactic information, in the input document. 1787 * Populated if the user enables 1788 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1789 * </pre> 1790 * 1791 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1792 */ getTokensBuilder(int index)1793 public com.google.cloud.language.v1.Token.Builder getTokensBuilder(int index) { 1794 return getTokensFieldBuilder().getBuilder(index); 1795 } 1796 /** 1797 * 1798 * 1799 * <pre> 1800 * Tokens, along with their syntactic information, in the input document. 1801 * Populated if the user enables 1802 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1803 * </pre> 1804 * 1805 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1806 */ getTokensOrBuilder(int index)1807 public com.google.cloud.language.v1.TokenOrBuilder getTokensOrBuilder(int index) { 1808 if (tokensBuilder_ == null) { 1809 return tokens_.get(index); 1810 } else { 1811 return tokensBuilder_.getMessageOrBuilder(index); 1812 } 1813 } 1814 /** 1815 * 1816 * 1817 * <pre> 1818 * Tokens, along with their syntactic information, in the input document. 1819 * Populated if the user enables 1820 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1821 * </pre> 1822 * 1823 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1824 */ 1825 public java.util.List<? extends com.google.cloud.language.v1.TokenOrBuilder> getTokensOrBuilderList()1826 getTokensOrBuilderList() { 1827 if (tokensBuilder_ != null) { 1828 return tokensBuilder_.getMessageOrBuilderList(); 1829 } else { 1830 return java.util.Collections.unmodifiableList(tokens_); 1831 } 1832 } 1833 /** 1834 * 1835 * 1836 * <pre> 1837 * Tokens, along with their syntactic information, in the input document. 1838 * Populated if the user enables 1839 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1840 * </pre> 1841 * 1842 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1843 */ addTokensBuilder()1844 public com.google.cloud.language.v1.Token.Builder addTokensBuilder() { 1845 return getTokensFieldBuilder() 1846 .addBuilder(com.google.cloud.language.v1.Token.getDefaultInstance()); 1847 } 1848 /** 1849 * 1850 * 1851 * <pre> 1852 * Tokens, along with their syntactic information, in the input document. 1853 * Populated if the user enables 1854 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1855 * </pre> 1856 * 1857 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1858 */ addTokensBuilder(int index)1859 public com.google.cloud.language.v1.Token.Builder addTokensBuilder(int index) { 1860 return getTokensFieldBuilder() 1861 .addBuilder(index, com.google.cloud.language.v1.Token.getDefaultInstance()); 1862 } 1863 /** 1864 * 1865 * 1866 * <pre> 1867 * Tokens, along with their syntactic information, in the input document. 1868 * Populated if the user enables 1869 * [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1.AnnotateTextRequest.Features.extract_syntax]. 1870 * </pre> 1871 * 1872 * <code>repeated .google.cloud.language.v1.Token tokens = 2;</code> 1873 */ getTokensBuilderList()1874 public java.util.List<com.google.cloud.language.v1.Token.Builder> getTokensBuilderList() { 1875 return getTokensFieldBuilder().getBuilderList(); 1876 } 1877 1878 private com.google.protobuf.RepeatedFieldBuilderV3< 1879 com.google.cloud.language.v1.Token, 1880 com.google.cloud.language.v1.Token.Builder, 1881 com.google.cloud.language.v1.TokenOrBuilder> getTokensFieldBuilder()1882 getTokensFieldBuilder() { 1883 if (tokensBuilder_ == null) { 1884 tokensBuilder_ = 1885 new com.google.protobuf.RepeatedFieldBuilderV3< 1886 com.google.cloud.language.v1.Token, 1887 com.google.cloud.language.v1.Token.Builder, 1888 com.google.cloud.language.v1.TokenOrBuilder>( 1889 tokens_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); 1890 tokens_ = null; 1891 } 1892 return tokensBuilder_; 1893 } 1894 1895 private java.util.List<com.google.cloud.language.v1.Entity> entities_ = 1896 java.util.Collections.emptyList(); 1897 ensureEntitiesIsMutable()1898 private void ensureEntitiesIsMutable() { 1899 if (!((bitField0_ & 0x00000004) != 0)) { 1900 entities_ = new java.util.ArrayList<com.google.cloud.language.v1.Entity>(entities_); 1901 bitField0_ |= 0x00000004; 1902 } 1903 } 1904 1905 private com.google.protobuf.RepeatedFieldBuilderV3< 1906 com.google.cloud.language.v1.Entity, 1907 com.google.cloud.language.v1.Entity.Builder, 1908 com.google.cloud.language.v1.EntityOrBuilder> 1909 entitiesBuilder_; 1910 1911 /** 1912 * 1913 * 1914 * <pre> 1915 * Entities, along with their semantic information, in the input document. 1916 * Populated if the user enables 1917 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 1918 * </pre> 1919 * 1920 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 1921 */ getEntitiesList()1922 public java.util.List<com.google.cloud.language.v1.Entity> getEntitiesList() { 1923 if (entitiesBuilder_ == null) { 1924 return java.util.Collections.unmodifiableList(entities_); 1925 } else { 1926 return entitiesBuilder_.getMessageList(); 1927 } 1928 } 1929 /** 1930 * 1931 * 1932 * <pre> 1933 * Entities, along with their semantic information, in the input document. 1934 * Populated if the user enables 1935 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 1936 * </pre> 1937 * 1938 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 1939 */ getEntitiesCount()1940 public int getEntitiesCount() { 1941 if (entitiesBuilder_ == null) { 1942 return entities_.size(); 1943 } else { 1944 return entitiesBuilder_.getCount(); 1945 } 1946 } 1947 /** 1948 * 1949 * 1950 * <pre> 1951 * Entities, along with their semantic information, in the input document. 1952 * Populated if the user enables 1953 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 1954 * </pre> 1955 * 1956 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 1957 */ getEntities(int index)1958 public com.google.cloud.language.v1.Entity getEntities(int index) { 1959 if (entitiesBuilder_ == null) { 1960 return entities_.get(index); 1961 } else { 1962 return entitiesBuilder_.getMessage(index); 1963 } 1964 } 1965 /** 1966 * 1967 * 1968 * <pre> 1969 * Entities, along with their semantic information, in the input document. 1970 * Populated if the user enables 1971 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 1972 * </pre> 1973 * 1974 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 1975 */ setEntities(int index, com.google.cloud.language.v1.Entity value)1976 public Builder setEntities(int index, com.google.cloud.language.v1.Entity value) { 1977 if (entitiesBuilder_ == null) { 1978 if (value == null) { 1979 throw new NullPointerException(); 1980 } 1981 ensureEntitiesIsMutable(); 1982 entities_.set(index, value); 1983 onChanged(); 1984 } else { 1985 entitiesBuilder_.setMessage(index, value); 1986 } 1987 return this; 1988 } 1989 /** 1990 * 1991 * 1992 * <pre> 1993 * Entities, along with their semantic information, in the input document. 1994 * Populated if the user enables 1995 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 1996 * </pre> 1997 * 1998 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 1999 */ setEntities( int index, com.google.cloud.language.v1.Entity.Builder builderForValue)2000 public Builder setEntities( 2001 int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { 2002 if (entitiesBuilder_ == null) { 2003 ensureEntitiesIsMutable(); 2004 entities_.set(index, builderForValue.build()); 2005 onChanged(); 2006 } else { 2007 entitiesBuilder_.setMessage(index, builderForValue.build()); 2008 } 2009 return this; 2010 } 2011 /** 2012 * 2013 * 2014 * <pre> 2015 * Entities, along with their semantic information, in the input document. 2016 * Populated if the user enables 2017 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2018 * </pre> 2019 * 2020 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2021 */ addEntities(com.google.cloud.language.v1.Entity value)2022 public Builder addEntities(com.google.cloud.language.v1.Entity value) { 2023 if (entitiesBuilder_ == null) { 2024 if (value == null) { 2025 throw new NullPointerException(); 2026 } 2027 ensureEntitiesIsMutable(); 2028 entities_.add(value); 2029 onChanged(); 2030 } else { 2031 entitiesBuilder_.addMessage(value); 2032 } 2033 return this; 2034 } 2035 /** 2036 * 2037 * 2038 * <pre> 2039 * Entities, along with their semantic information, in the input document. 2040 * Populated if the user enables 2041 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2042 * </pre> 2043 * 2044 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2045 */ addEntities(int index, com.google.cloud.language.v1.Entity value)2046 public Builder addEntities(int index, com.google.cloud.language.v1.Entity value) { 2047 if (entitiesBuilder_ == null) { 2048 if (value == null) { 2049 throw new NullPointerException(); 2050 } 2051 ensureEntitiesIsMutable(); 2052 entities_.add(index, value); 2053 onChanged(); 2054 } else { 2055 entitiesBuilder_.addMessage(index, value); 2056 } 2057 return this; 2058 } 2059 /** 2060 * 2061 * 2062 * <pre> 2063 * Entities, along with their semantic information, in the input document. 2064 * Populated if the user enables 2065 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2066 * </pre> 2067 * 2068 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2069 */ addEntities(com.google.cloud.language.v1.Entity.Builder builderForValue)2070 public Builder addEntities(com.google.cloud.language.v1.Entity.Builder builderForValue) { 2071 if (entitiesBuilder_ == null) { 2072 ensureEntitiesIsMutable(); 2073 entities_.add(builderForValue.build()); 2074 onChanged(); 2075 } else { 2076 entitiesBuilder_.addMessage(builderForValue.build()); 2077 } 2078 return this; 2079 } 2080 /** 2081 * 2082 * 2083 * <pre> 2084 * Entities, along with their semantic information, in the input document. 2085 * Populated if the user enables 2086 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2087 * </pre> 2088 * 2089 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2090 */ addEntities( int index, com.google.cloud.language.v1.Entity.Builder builderForValue)2091 public Builder addEntities( 2092 int index, com.google.cloud.language.v1.Entity.Builder builderForValue) { 2093 if (entitiesBuilder_ == null) { 2094 ensureEntitiesIsMutable(); 2095 entities_.add(index, builderForValue.build()); 2096 onChanged(); 2097 } else { 2098 entitiesBuilder_.addMessage(index, builderForValue.build()); 2099 } 2100 return this; 2101 } 2102 /** 2103 * 2104 * 2105 * <pre> 2106 * Entities, along with their semantic information, in the input document. 2107 * Populated if the user enables 2108 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2109 * </pre> 2110 * 2111 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2112 */ addAllEntities( java.lang.Iterable<? extends com.google.cloud.language.v1.Entity> values)2113 public Builder addAllEntities( 2114 java.lang.Iterable<? extends com.google.cloud.language.v1.Entity> values) { 2115 if (entitiesBuilder_ == null) { 2116 ensureEntitiesIsMutable(); 2117 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, entities_); 2118 onChanged(); 2119 } else { 2120 entitiesBuilder_.addAllMessages(values); 2121 } 2122 return this; 2123 } 2124 /** 2125 * 2126 * 2127 * <pre> 2128 * Entities, along with their semantic information, in the input document. 2129 * Populated if the user enables 2130 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2131 * </pre> 2132 * 2133 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2134 */ clearEntities()2135 public Builder clearEntities() { 2136 if (entitiesBuilder_ == null) { 2137 entities_ = java.util.Collections.emptyList(); 2138 bitField0_ = (bitField0_ & ~0x00000004); 2139 onChanged(); 2140 } else { 2141 entitiesBuilder_.clear(); 2142 } 2143 return this; 2144 } 2145 /** 2146 * 2147 * 2148 * <pre> 2149 * Entities, along with their semantic information, in the input document. 2150 * Populated if the user enables 2151 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2152 * </pre> 2153 * 2154 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2155 */ removeEntities(int index)2156 public Builder removeEntities(int index) { 2157 if (entitiesBuilder_ == null) { 2158 ensureEntitiesIsMutable(); 2159 entities_.remove(index); 2160 onChanged(); 2161 } else { 2162 entitiesBuilder_.remove(index); 2163 } 2164 return this; 2165 } 2166 /** 2167 * 2168 * 2169 * <pre> 2170 * Entities, along with their semantic information, in the input document. 2171 * Populated if the user enables 2172 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2173 * </pre> 2174 * 2175 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2176 */ getEntitiesBuilder(int index)2177 public com.google.cloud.language.v1.Entity.Builder getEntitiesBuilder(int index) { 2178 return getEntitiesFieldBuilder().getBuilder(index); 2179 } 2180 /** 2181 * 2182 * 2183 * <pre> 2184 * Entities, along with their semantic information, in the input document. 2185 * Populated if the user enables 2186 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2187 * </pre> 2188 * 2189 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2190 */ getEntitiesOrBuilder(int index)2191 public com.google.cloud.language.v1.EntityOrBuilder getEntitiesOrBuilder(int index) { 2192 if (entitiesBuilder_ == null) { 2193 return entities_.get(index); 2194 } else { 2195 return entitiesBuilder_.getMessageOrBuilder(index); 2196 } 2197 } 2198 /** 2199 * 2200 * 2201 * <pre> 2202 * Entities, along with their semantic information, in the input document. 2203 * Populated if the user enables 2204 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2205 * </pre> 2206 * 2207 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2208 */ 2209 public java.util.List<? extends com.google.cloud.language.v1.EntityOrBuilder> getEntitiesOrBuilderList()2210 getEntitiesOrBuilderList() { 2211 if (entitiesBuilder_ != null) { 2212 return entitiesBuilder_.getMessageOrBuilderList(); 2213 } else { 2214 return java.util.Collections.unmodifiableList(entities_); 2215 } 2216 } 2217 /** 2218 * 2219 * 2220 * <pre> 2221 * Entities, along with their semantic information, in the input document. 2222 * Populated if the user enables 2223 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2224 * </pre> 2225 * 2226 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2227 */ addEntitiesBuilder()2228 public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder() { 2229 return getEntitiesFieldBuilder() 2230 .addBuilder(com.google.cloud.language.v1.Entity.getDefaultInstance()); 2231 } 2232 /** 2233 * 2234 * 2235 * <pre> 2236 * Entities, along with their semantic information, in the input document. 2237 * Populated if the user enables 2238 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2239 * </pre> 2240 * 2241 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2242 */ addEntitiesBuilder(int index)2243 public com.google.cloud.language.v1.Entity.Builder addEntitiesBuilder(int index) { 2244 return getEntitiesFieldBuilder() 2245 .addBuilder(index, com.google.cloud.language.v1.Entity.getDefaultInstance()); 2246 } 2247 /** 2248 * 2249 * 2250 * <pre> 2251 * Entities, along with their semantic information, in the input document. 2252 * Populated if the user enables 2253 * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1.AnnotateTextRequest.Features.extract_entities]. 2254 * </pre> 2255 * 2256 * <code>repeated .google.cloud.language.v1.Entity entities = 3;</code> 2257 */ getEntitiesBuilderList()2258 public java.util.List<com.google.cloud.language.v1.Entity.Builder> getEntitiesBuilderList() { 2259 return getEntitiesFieldBuilder().getBuilderList(); 2260 } 2261 2262 private com.google.protobuf.RepeatedFieldBuilderV3< 2263 com.google.cloud.language.v1.Entity, 2264 com.google.cloud.language.v1.Entity.Builder, 2265 com.google.cloud.language.v1.EntityOrBuilder> getEntitiesFieldBuilder()2266 getEntitiesFieldBuilder() { 2267 if (entitiesBuilder_ == null) { 2268 entitiesBuilder_ = 2269 new com.google.protobuf.RepeatedFieldBuilderV3< 2270 com.google.cloud.language.v1.Entity, 2271 com.google.cloud.language.v1.Entity.Builder, 2272 com.google.cloud.language.v1.EntityOrBuilder>( 2273 entities_, ((bitField0_ & 0x00000004) != 0), getParentForChildren(), isClean()); 2274 entities_ = null; 2275 } 2276 return entitiesBuilder_; 2277 } 2278 2279 private com.google.cloud.language.v1.Sentiment documentSentiment_; 2280 private com.google.protobuf.SingleFieldBuilderV3< 2281 com.google.cloud.language.v1.Sentiment, 2282 com.google.cloud.language.v1.Sentiment.Builder, 2283 com.google.cloud.language.v1.SentimentOrBuilder> 2284 documentSentimentBuilder_; 2285 /** 2286 * 2287 * 2288 * <pre> 2289 * The overall sentiment for the document. Populated if the user enables 2290 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2291 * </pre> 2292 * 2293 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2294 * 2295 * @return Whether the documentSentiment field is set. 2296 */ hasDocumentSentiment()2297 public boolean hasDocumentSentiment() { 2298 return ((bitField0_ & 0x00000008) != 0); 2299 } 2300 /** 2301 * 2302 * 2303 * <pre> 2304 * The overall sentiment for the document. Populated if the user enables 2305 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2306 * </pre> 2307 * 2308 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2309 * 2310 * @return The documentSentiment. 2311 */ getDocumentSentiment()2312 public com.google.cloud.language.v1.Sentiment getDocumentSentiment() { 2313 if (documentSentimentBuilder_ == null) { 2314 return documentSentiment_ == null 2315 ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() 2316 : documentSentiment_; 2317 } else { 2318 return documentSentimentBuilder_.getMessage(); 2319 } 2320 } 2321 /** 2322 * 2323 * 2324 * <pre> 2325 * The overall sentiment for the document. Populated if the user enables 2326 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2327 * </pre> 2328 * 2329 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2330 */ setDocumentSentiment(com.google.cloud.language.v1.Sentiment value)2331 public Builder setDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { 2332 if (documentSentimentBuilder_ == null) { 2333 if (value == null) { 2334 throw new NullPointerException(); 2335 } 2336 documentSentiment_ = value; 2337 } else { 2338 documentSentimentBuilder_.setMessage(value); 2339 } 2340 bitField0_ |= 0x00000008; 2341 onChanged(); 2342 return this; 2343 } 2344 /** 2345 * 2346 * 2347 * <pre> 2348 * The overall sentiment for the document. Populated if the user enables 2349 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2350 * </pre> 2351 * 2352 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2353 */ setDocumentSentiment( com.google.cloud.language.v1.Sentiment.Builder builderForValue)2354 public Builder setDocumentSentiment( 2355 com.google.cloud.language.v1.Sentiment.Builder builderForValue) { 2356 if (documentSentimentBuilder_ == null) { 2357 documentSentiment_ = builderForValue.build(); 2358 } else { 2359 documentSentimentBuilder_.setMessage(builderForValue.build()); 2360 } 2361 bitField0_ |= 0x00000008; 2362 onChanged(); 2363 return this; 2364 } 2365 /** 2366 * 2367 * 2368 * <pre> 2369 * The overall sentiment for the document. Populated if the user enables 2370 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2371 * </pre> 2372 * 2373 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2374 */ mergeDocumentSentiment(com.google.cloud.language.v1.Sentiment value)2375 public Builder mergeDocumentSentiment(com.google.cloud.language.v1.Sentiment value) { 2376 if (documentSentimentBuilder_ == null) { 2377 if (((bitField0_ & 0x00000008) != 0) 2378 && documentSentiment_ != null 2379 && documentSentiment_ != com.google.cloud.language.v1.Sentiment.getDefaultInstance()) { 2380 getDocumentSentimentBuilder().mergeFrom(value); 2381 } else { 2382 documentSentiment_ = value; 2383 } 2384 } else { 2385 documentSentimentBuilder_.mergeFrom(value); 2386 } 2387 bitField0_ |= 0x00000008; 2388 onChanged(); 2389 return this; 2390 } 2391 /** 2392 * 2393 * 2394 * <pre> 2395 * The overall sentiment for the document. Populated if the user enables 2396 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2397 * </pre> 2398 * 2399 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2400 */ clearDocumentSentiment()2401 public Builder clearDocumentSentiment() { 2402 bitField0_ = (bitField0_ & ~0x00000008); 2403 documentSentiment_ = null; 2404 if (documentSentimentBuilder_ != null) { 2405 documentSentimentBuilder_.dispose(); 2406 documentSentimentBuilder_ = null; 2407 } 2408 onChanged(); 2409 return this; 2410 } 2411 /** 2412 * 2413 * 2414 * <pre> 2415 * The overall sentiment for the document. Populated if the user enables 2416 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2417 * </pre> 2418 * 2419 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2420 */ getDocumentSentimentBuilder()2421 public com.google.cloud.language.v1.Sentiment.Builder getDocumentSentimentBuilder() { 2422 bitField0_ |= 0x00000008; 2423 onChanged(); 2424 return getDocumentSentimentFieldBuilder().getBuilder(); 2425 } 2426 /** 2427 * 2428 * 2429 * <pre> 2430 * The overall sentiment for the document. Populated if the user enables 2431 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2432 * </pre> 2433 * 2434 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2435 */ getDocumentSentimentOrBuilder()2436 public com.google.cloud.language.v1.SentimentOrBuilder getDocumentSentimentOrBuilder() { 2437 if (documentSentimentBuilder_ != null) { 2438 return documentSentimentBuilder_.getMessageOrBuilder(); 2439 } else { 2440 return documentSentiment_ == null 2441 ? com.google.cloud.language.v1.Sentiment.getDefaultInstance() 2442 : documentSentiment_; 2443 } 2444 } 2445 /** 2446 * 2447 * 2448 * <pre> 2449 * The overall sentiment for the document. Populated if the user enables 2450 * [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1.AnnotateTextRequest.Features.extract_document_sentiment]. 2451 * </pre> 2452 * 2453 * <code>.google.cloud.language.v1.Sentiment document_sentiment = 4;</code> 2454 */ 2455 private com.google.protobuf.SingleFieldBuilderV3< 2456 com.google.cloud.language.v1.Sentiment, 2457 com.google.cloud.language.v1.Sentiment.Builder, 2458 com.google.cloud.language.v1.SentimentOrBuilder> getDocumentSentimentFieldBuilder()2459 getDocumentSentimentFieldBuilder() { 2460 if (documentSentimentBuilder_ == null) { 2461 documentSentimentBuilder_ = 2462 new com.google.protobuf.SingleFieldBuilderV3< 2463 com.google.cloud.language.v1.Sentiment, 2464 com.google.cloud.language.v1.Sentiment.Builder, 2465 com.google.cloud.language.v1.SentimentOrBuilder>( 2466 getDocumentSentiment(), getParentForChildren(), isClean()); 2467 documentSentiment_ = null; 2468 } 2469 return documentSentimentBuilder_; 2470 } 2471 2472 private java.lang.Object language_ = ""; 2473 /** 2474 * 2475 * 2476 * <pre> 2477 * The language of the text, which will be the same as the language specified 2478 * in the request or, if not specified, the automatically-detected language. 2479 * See [Document.language][google.cloud.language.v1.Document.language] field 2480 * for more details. 2481 * </pre> 2482 * 2483 * <code>string language = 5;</code> 2484 * 2485 * @return The language. 2486 */ getLanguage()2487 public java.lang.String getLanguage() { 2488 java.lang.Object ref = language_; 2489 if (!(ref instanceof java.lang.String)) { 2490 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 2491 java.lang.String s = bs.toStringUtf8(); 2492 language_ = s; 2493 return s; 2494 } else { 2495 return (java.lang.String) ref; 2496 } 2497 } 2498 /** 2499 * 2500 * 2501 * <pre> 2502 * The language of the text, which will be the same as the language specified 2503 * in the request or, if not specified, the automatically-detected language. 2504 * See [Document.language][google.cloud.language.v1.Document.language] field 2505 * for more details. 2506 * </pre> 2507 * 2508 * <code>string language = 5;</code> 2509 * 2510 * @return The bytes for language. 2511 */ getLanguageBytes()2512 public com.google.protobuf.ByteString getLanguageBytes() { 2513 java.lang.Object ref = language_; 2514 if (ref instanceof String) { 2515 com.google.protobuf.ByteString b = 2516 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 2517 language_ = b; 2518 return b; 2519 } else { 2520 return (com.google.protobuf.ByteString) ref; 2521 } 2522 } 2523 /** 2524 * 2525 * 2526 * <pre> 2527 * The language of the text, which will be the same as the language specified 2528 * in the request or, if not specified, the automatically-detected language. 2529 * See [Document.language][google.cloud.language.v1.Document.language] field 2530 * for more details. 2531 * </pre> 2532 * 2533 * <code>string language = 5;</code> 2534 * 2535 * @param value The language to set. 2536 * @return This builder for chaining. 2537 */ setLanguage(java.lang.String value)2538 public Builder setLanguage(java.lang.String value) { 2539 if (value == null) { 2540 throw new NullPointerException(); 2541 } 2542 language_ = value; 2543 bitField0_ |= 0x00000010; 2544 onChanged(); 2545 return this; 2546 } 2547 /** 2548 * 2549 * 2550 * <pre> 2551 * The language of the text, which will be the same as the language specified 2552 * in the request or, if not specified, the automatically-detected language. 2553 * See [Document.language][google.cloud.language.v1.Document.language] field 2554 * for more details. 2555 * </pre> 2556 * 2557 * <code>string language = 5;</code> 2558 * 2559 * @return This builder for chaining. 2560 */ clearLanguage()2561 public Builder clearLanguage() { 2562 language_ = getDefaultInstance().getLanguage(); 2563 bitField0_ = (bitField0_ & ~0x00000010); 2564 onChanged(); 2565 return this; 2566 } 2567 /** 2568 * 2569 * 2570 * <pre> 2571 * The language of the text, which will be the same as the language specified 2572 * in the request or, if not specified, the automatically-detected language. 2573 * See [Document.language][google.cloud.language.v1.Document.language] field 2574 * for more details. 2575 * </pre> 2576 * 2577 * <code>string language = 5;</code> 2578 * 2579 * @param value The bytes for language to set. 2580 * @return This builder for chaining. 2581 */ setLanguageBytes(com.google.protobuf.ByteString value)2582 public Builder setLanguageBytes(com.google.protobuf.ByteString value) { 2583 if (value == null) { 2584 throw new NullPointerException(); 2585 } 2586 checkByteStringIsUtf8(value); 2587 language_ = value; 2588 bitField0_ |= 0x00000010; 2589 onChanged(); 2590 return this; 2591 } 2592 2593 private java.util.List<com.google.cloud.language.v1.ClassificationCategory> categories_ = 2594 java.util.Collections.emptyList(); 2595 ensureCategoriesIsMutable()2596 private void ensureCategoriesIsMutable() { 2597 if (!((bitField0_ & 0x00000020) != 0)) { 2598 categories_ = 2599 new java.util.ArrayList<com.google.cloud.language.v1.ClassificationCategory>( 2600 categories_); 2601 bitField0_ |= 0x00000020; 2602 } 2603 } 2604 2605 private com.google.protobuf.RepeatedFieldBuilderV3< 2606 com.google.cloud.language.v1.ClassificationCategory, 2607 com.google.cloud.language.v1.ClassificationCategory.Builder, 2608 com.google.cloud.language.v1.ClassificationCategoryOrBuilder> 2609 categoriesBuilder_; 2610 2611 /** 2612 * 2613 * 2614 * <pre> 2615 * Categories identified in the input document. 2616 * </pre> 2617 * 2618 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2619 */ getCategoriesList()2620 public java.util.List<com.google.cloud.language.v1.ClassificationCategory> getCategoriesList() { 2621 if (categoriesBuilder_ == null) { 2622 return java.util.Collections.unmodifiableList(categories_); 2623 } else { 2624 return categoriesBuilder_.getMessageList(); 2625 } 2626 } 2627 /** 2628 * 2629 * 2630 * <pre> 2631 * Categories identified in the input document. 2632 * </pre> 2633 * 2634 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2635 */ getCategoriesCount()2636 public int getCategoriesCount() { 2637 if (categoriesBuilder_ == null) { 2638 return categories_.size(); 2639 } else { 2640 return categoriesBuilder_.getCount(); 2641 } 2642 } 2643 /** 2644 * 2645 * 2646 * <pre> 2647 * Categories identified in the input document. 2648 * </pre> 2649 * 2650 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2651 */ getCategories(int index)2652 public com.google.cloud.language.v1.ClassificationCategory getCategories(int index) { 2653 if (categoriesBuilder_ == null) { 2654 return categories_.get(index); 2655 } else { 2656 return categoriesBuilder_.getMessage(index); 2657 } 2658 } 2659 /** 2660 * 2661 * 2662 * <pre> 2663 * Categories identified in the input document. 2664 * </pre> 2665 * 2666 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2667 */ setCategories( int index, com.google.cloud.language.v1.ClassificationCategory value)2668 public Builder setCategories( 2669 int index, com.google.cloud.language.v1.ClassificationCategory value) { 2670 if (categoriesBuilder_ == null) { 2671 if (value == null) { 2672 throw new NullPointerException(); 2673 } 2674 ensureCategoriesIsMutable(); 2675 categories_.set(index, value); 2676 onChanged(); 2677 } else { 2678 categoriesBuilder_.setMessage(index, value); 2679 } 2680 return this; 2681 } 2682 /** 2683 * 2684 * 2685 * <pre> 2686 * Categories identified in the input document. 2687 * </pre> 2688 * 2689 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2690 */ setCategories( int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue)2691 public Builder setCategories( 2692 int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { 2693 if (categoriesBuilder_ == null) { 2694 ensureCategoriesIsMutable(); 2695 categories_.set(index, builderForValue.build()); 2696 onChanged(); 2697 } else { 2698 categoriesBuilder_.setMessage(index, builderForValue.build()); 2699 } 2700 return this; 2701 } 2702 /** 2703 * 2704 * 2705 * <pre> 2706 * Categories identified in the input document. 2707 * </pre> 2708 * 2709 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2710 */ addCategories(com.google.cloud.language.v1.ClassificationCategory value)2711 public Builder addCategories(com.google.cloud.language.v1.ClassificationCategory value) { 2712 if (categoriesBuilder_ == null) { 2713 if (value == null) { 2714 throw new NullPointerException(); 2715 } 2716 ensureCategoriesIsMutable(); 2717 categories_.add(value); 2718 onChanged(); 2719 } else { 2720 categoriesBuilder_.addMessage(value); 2721 } 2722 return this; 2723 } 2724 /** 2725 * 2726 * 2727 * <pre> 2728 * Categories identified in the input document. 2729 * </pre> 2730 * 2731 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2732 */ addCategories( int index, com.google.cloud.language.v1.ClassificationCategory value)2733 public Builder addCategories( 2734 int index, com.google.cloud.language.v1.ClassificationCategory value) { 2735 if (categoriesBuilder_ == null) { 2736 if (value == null) { 2737 throw new NullPointerException(); 2738 } 2739 ensureCategoriesIsMutable(); 2740 categories_.add(index, value); 2741 onChanged(); 2742 } else { 2743 categoriesBuilder_.addMessage(index, value); 2744 } 2745 return this; 2746 } 2747 /** 2748 * 2749 * 2750 * <pre> 2751 * Categories identified in the input document. 2752 * </pre> 2753 * 2754 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2755 */ addCategories( com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue)2756 public Builder addCategories( 2757 com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { 2758 if (categoriesBuilder_ == null) { 2759 ensureCategoriesIsMutable(); 2760 categories_.add(builderForValue.build()); 2761 onChanged(); 2762 } else { 2763 categoriesBuilder_.addMessage(builderForValue.build()); 2764 } 2765 return this; 2766 } 2767 /** 2768 * 2769 * 2770 * <pre> 2771 * Categories identified in the input document. 2772 * </pre> 2773 * 2774 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2775 */ addCategories( int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue)2776 public Builder addCategories( 2777 int index, com.google.cloud.language.v1.ClassificationCategory.Builder builderForValue) { 2778 if (categoriesBuilder_ == null) { 2779 ensureCategoriesIsMutable(); 2780 categories_.add(index, builderForValue.build()); 2781 onChanged(); 2782 } else { 2783 categoriesBuilder_.addMessage(index, builderForValue.build()); 2784 } 2785 return this; 2786 } 2787 /** 2788 * 2789 * 2790 * <pre> 2791 * Categories identified in the input document. 2792 * </pre> 2793 * 2794 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2795 */ addAllCategories( java.lang.Iterable<? extends com.google.cloud.language.v1.ClassificationCategory> values)2796 public Builder addAllCategories( 2797 java.lang.Iterable<? extends com.google.cloud.language.v1.ClassificationCategory> values) { 2798 if (categoriesBuilder_ == null) { 2799 ensureCategoriesIsMutable(); 2800 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, categories_); 2801 onChanged(); 2802 } else { 2803 categoriesBuilder_.addAllMessages(values); 2804 } 2805 return this; 2806 } 2807 /** 2808 * 2809 * 2810 * <pre> 2811 * Categories identified in the input document. 2812 * </pre> 2813 * 2814 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2815 */ clearCategories()2816 public Builder clearCategories() { 2817 if (categoriesBuilder_ == null) { 2818 categories_ = java.util.Collections.emptyList(); 2819 bitField0_ = (bitField0_ & ~0x00000020); 2820 onChanged(); 2821 } else { 2822 categoriesBuilder_.clear(); 2823 } 2824 return this; 2825 } 2826 /** 2827 * 2828 * 2829 * <pre> 2830 * Categories identified in the input document. 2831 * </pre> 2832 * 2833 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2834 */ removeCategories(int index)2835 public Builder removeCategories(int index) { 2836 if (categoriesBuilder_ == null) { 2837 ensureCategoriesIsMutable(); 2838 categories_.remove(index); 2839 onChanged(); 2840 } else { 2841 categoriesBuilder_.remove(index); 2842 } 2843 return this; 2844 } 2845 /** 2846 * 2847 * 2848 * <pre> 2849 * Categories identified in the input document. 2850 * </pre> 2851 * 2852 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2853 */ getCategoriesBuilder( int index)2854 public com.google.cloud.language.v1.ClassificationCategory.Builder getCategoriesBuilder( 2855 int index) { 2856 return getCategoriesFieldBuilder().getBuilder(index); 2857 } 2858 /** 2859 * 2860 * 2861 * <pre> 2862 * Categories identified in the input document. 2863 * </pre> 2864 * 2865 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2866 */ getCategoriesOrBuilder( int index)2867 public com.google.cloud.language.v1.ClassificationCategoryOrBuilder getCategoriesOrBuilder( 2868 int index) { 2869 if (categoriesBuilder_ == null) { 2870 return categories_.get(index); 2871 } else { 2872 return categoriesBuilder_.getMessageOrBuilder(index); 2873 } 2874 } 2875 /** 2876 * 2877 * 2878 * <pre> 2879 * Categories identified in the input document. 2880 * </pre> 2881 * 2882 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2883 */ 2884 public java.util.List<? extends com.google.cloud.language.v1.ClassificationCategoryOrBuilder> getCategoriesOrBuilderList()2885 getCategoriesOrBuilderList() { 2886 if (categoriesBuilder_ != null) { 2887 return categoriesBuilder_.getMessageOrBuilderList(); 2888 } else { 2889 return java.util.Collections.unmodifiableList(categories_); 2890 } 2891 } 2892 /** 2893 * 2894 * 2895 * <pre> 2896 * Categories identified in the input document. 2897 * </pre> 2898 * 2899 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2900 */ addCategoriesBuilder()2901 public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder() { 2902 return getCategoriesFieldBuilder() 2903 .addBuilder(com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); 2904 } 2905 /** 2906 * 2907 * 2908 * <pre> 2909 * Categories identified in the input document. 2910 * </pre> 2911 * 2912 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2913 */ addCategoriesBuilder( int index)2914 public com.google.cloud.language.v1.ClassificationCategory.Builder addCategoriesBuilder( 2915 int index) { 2916 return getCategoriesFieldBuilder() 2917 .addBuilder( 2918 index, com.google.cloud.language.v1.ClassificationCategory.getDefaultInstance()); 2919 } 2920 /** 2921 * 2922 * 2923 * <pre> 2924 * Categories identified in the input document. 2925 * </pre> 2926 * 2927 * <code>repeated .google.cloud.language.v1.ClassificationCategory categories = 6;</code> 2928 */ 2929 public java.util.List<com.google.cloud.language.v1.ClassificationCategory.Builder> getCategoriesBuilderList()2930 getCategoriesBuilderList() { 2931 return getCategoriesFieldBuilder().getBuilderList(); 2932 } 2933 2934 private com.google.protobuf.RepeatedFieldBuilderV3< 2935 com.google.cloud.language.v1.ClassificationCategory, 2936 com.google.cloud.language.v1.ClassificationCategory.Builder, 2937 com.google.cloud.language.v1.ClassificationCategoryOrBuilder> getCategoriesFieldBuilder()2938 getCategoriesFieldBuilder() { 2939 if (categoriesBuilder_ == null) { 2940 categoriesBuilder_ = 2941 new com.google.protobuf.RepeatedFieldBuilderV3< 2942 com.google.cloud.language.v1.ClassificationCategory, 2943 com.google.cloud.language.v1.ClassificationCategory.Builder, 2944 com.google.cloud.language.v1.ClassificationCategoryOrBuilder>( 2945 categories_, ((bitField0_ & 0x00000020) != 0), getParentForChildren(), isClean()); 2946 categories_ = null; 2947 } 2948 return categoriesBuilder_; 2949 } 2950 2951 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)2952 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 2953 return super.setUnknownFields(unknownFields); 2954 } 2955 2956 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2957 public final Builder mergeUnknownFields( 2958 final com.google.protobuf.UnknownFieldSet unknownFields) { 2959 return super.mergeUnknownFields(unknownFields); 2960 } 2961 2962 // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.AnnotateTextResponse) 2963 } 2964 2965 // @@protoc_insertion_point(class_scope:google.cloud.language.v1.AnnotateTextResponse) 2966 private static final com.google.cloud.language.v1.AnnotateTextResponse DEFAULT_INSTANCE; 2967 2968 static { 2969 DEFAULT_INSTANCE = new com.google.cloud.language.v1.AnnotateTextResponse(); 2970 } 2971 getDefaultInstance()2972 public static com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstance() { 2973 return DEFAULT_INSTANCE; 2974 } 2975 2976 private static final com.google.protobuf.Parser<AnnotateTextResponse> PARSER = 2977 new com.google.protobuf.AbstractParser<AnnotateTextResponse>() { 2978 @java.lang.Override 2979 public AnnotateTextResponse parsePartialFrom( 2980 com.google.protobuf.CodedInputStream input, 2981 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2982 throws com.google.protobuf.InvalidProtocolBufferException { 2983 Builder builder = newBuilder(); 2984 try { 2985 builder.mergeFrom(input, extensionRegistry); 2986 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2987 throw e.setUnfinishedMessage(builder.buildPartial()); 2988 } catch (com.google.protobuf.UninitializedMessageException e) { 2989 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 2990 } catch (java.io.IOException e) { 2991 throw new com.google.protobuf.InvalidProtocolBufferException(e) 2992 .setUnfinishedMessage(builder.buildPartial()); 2993 } 2994 return builder.buildPartial(); 2995 } 2996 }; 2997 parser()2998 public static com.google.protobuf.Parser<AnnotateTextResponse> parser() { 2999 return PARSER; 3000 } 3001 3002 @java.lang.Override getParserForType()3003 public com.google.protobuf.Parser<AnnotateTextResponse> getParserForType() { 3004 return PARSER; 3005 } 3006 3007 @java.lang.Override getDefaultInstanceForType()3008 public com.google.cloud.language.v1.AnnotateTextResponse getDefaultInstanceForType() { 3009 return DEFAULT_INSTANCE; 3010 } 3011 } 3012