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/v1beta2/language_service.proto 18 19 package com.google.cloud.language.v1beta2; 20 21 /** 22 * 23 * 24 * <pre> 25 * Represents a phrase in the text that is a known entity, such as 26 * a person, an organization, or location. The API associates information, such 27 * as salience and mentions, with entities. 28 * </pre> 29 * 30 * Protobuf type {@code google.cloud.language.v1beta2.Entity} 31 */ 32 public final class Entity extends com.google.protobuf.GeneratedMessageV3 33 implements 34 // @@protoc_insertion_point(message_implements:google.cloud.language.v1beta2.Entity) 35 EntityOrBuilder { 36 private static final long serialVersionUID = 0L; 37 // Use Entity.newBuilder() to construct. Entity(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)38 private Entity(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 39 super(builder); 40 } 41 Entity()42 private Entity() { 43 name_ = ""; 44 type_ = 0; 45 mentions_ = 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 Entity(); 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.v1beta2.LanguageServiceProto 61 .internal_static_google_cloud_language_v1beta2_Entity_descriptor; 62 } 63 64 @SuppressWarnings({"rawtypes"}) 65 @java.lang.Override internalGetMapField(int number)66 protected com.google.protobuf.MapField internalGetMapField(int number) { 67 switch (number) { 68 case 3: 69 return internalGetMetadata(); 70 default: 71 throw new RuntimeException("Invalid map field number: " + number); 72 } 73 } 74 75 @java.lang.Override 76 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()77 internalGetFieldAccessorTable() { 78 return com.google.cloud.language.v1beta2.LanguageServiceProto 79 .internal_static_google_cloud_language_v1beta2_Entity_fieldAccessorTable 80 .ensureFieldAccessorsInitialized( 81 com.google.cloud.language.v1beta2.Entity.class, 82 com.google.cloud.language.v1beta2.Entity.Builder.class); 83 } 84 85 /** 86 * 87 * 88 * <pre> 89 * The type of the entity. For most entity types, the associated metadata is a 90 * Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table 91 * below lists the associated fields for entities that have different 92 * metadata. 93 * </pre> 94 * 95 * Protobuf enum {@code google.cloud.language.v1beta2.Entity.Type} 96 */ 97 public enum Type implements com.google.protobuf.ProtocolMessageEnum { 98 /** 99 * 100 * 101 * <pre> 102 * Unknown 103 * </pre> 104 * 105 * <code>UNKNOWN = 0;</code> 106 */ 107 UNKNOWN(0), 108 /** 109 * 110 * 111 * <pre> 112 * Person 113 * </pre> 114 * 115 * <code>PERSON = 1;</code> 116 */ 117 PERSON(1), 118 /** 119 * 120 * 121 * <pre> 122 * Location 123 * </pre> 124 * 125 * <code>LOCATION = 2;</code> 126 */ 127 LOCATION(2), 128 /** 129 * 130 * 131 * <pre> 132 * Organization 133 * </pre> 134 * 135 * <code>ORGANIZATION = 3;</code> 136 */ 137 ORGANIZATION(3), 138 /** 139 * 140 * 141 * <pre> 142 * Event 143 * </pre> 144 * 145 * <code>EVENT = 4;</code> 146 */ 147 EVENT(4), 148 /** 149 * 150 * 151 * <pre> 152 * Artwork 153 * </pre> 154 * 155 * <code>WORK_OF_ART = 5;</code> 156 */ 157 WORK_OF_ART(5), 158 /** 159 * 160 * 161 * <pre> 162 * Consumer product 163 * </pre> 164 * 165 * <code>CONSUMER_GOOD = 6;</code> 166 */ 167 CONSUMER_GOOD(6), 168 /** 169 * 170 * 171 * <pre> 172 * Other types of entities 173 * </pre> 174 * 175 * <code>OTHER = 7;</code> 176 */ 177 OTHER(7), 178 /** 179 * 180 * 181 * <pre> 182 * Phone number 183 * The metadata lists the phone number, formatted according to local 184 * convention, plus whichever additional elements appear in the text: 185 * * `number` - the actual number, broken down into sections as per local 186 * convention 187 * * `national_prefix` - country code, if detected 188 * * `area_code` - region or area code, if detected 189 * * `extension` - phone extension (to be dialed after connection), if 190 * detected 191 * </pre> 192 * 193 * <code>PHONE_NUMBER = 9;</code> 194 */ 195 PHONE_NUMBER(9), 196 /** 197 * 198 * 199 * <pre> 200 * Address 201 * The metadata identifies the street number and locality plus whichever 202 * additional elements appear in the text: 203 * * `street_number` - street number 204 * * `locality` - city or town 205 * * `street_name` - street/route name, if detected 206 * * `postal_code` - postal code, if detected 207 * * `country` - country, if detected< 208 * * `broad_region` - administrative area, such as the state, if detected 209 * * `narrow_region` - smaller administrative area, such as county, if 210 * detected 211 * * `sublocality` - used in Asian addresses to demark a district within a 212 * city, if detected 213 * </pre> 214 * 215 * <code>ADDRESS = 10;</code> 216 */ 217 ADDRESS(10), 218 /** 219 * 220 * 221 * <pre> 222 * Date 223 * The metadata identifies the components of the date: 224 * * `year` - four digit year, if detected 225 * * `month` - two digit month number, if detected 226 * * `day` - two digit day number, if detected 227 * </pre> 228 * 229 * <code>DATE = 11;</code> 230 */ 231 DATE(11), 232 /** 233 * 234 * 235 * <pre> 236 * Number 237 * The metadata is the number itself. 238 * </pre> 239 * 240 * <code>NUMBER = 12;</code> 241 */ 242 NUMBER(12), 243 /** 244 * 245 * 246 * <pre> 247 * Price 248 * The metadata identifies the `value` and `currency`. 249 * </pre> 250 * 251 * <code>PRICE = 13;</code> 252 */ 253 PRICE(13), 254 UNRECOGNIZED(-1), 255 ; 256 257 /** 258 * 259 * 260 * <pre> 261 * Unknown 262 * </pre> 263 * 264 * <code>UNKNOWN = 0;</code> 265 */ 266 public static final int UNKNOWN_VALUE = 0; 267 /** 268 * 269 * 270 * <pre> 271 * Person 272 * </pre> 273 * 274 * <code>PERSON = 1;</code> 275 */ 276 public static final int PERSON_VALUE = 1; 277 /** 278 * 279 * 280 * <pre> 281 * Location 282 * </pre> 283 * 284 * <code>LOCATION = 2;</code> 285 */ 286 public static final int LOCATION_VALUE = 2; 287 /** 288 * 289 * 290 * <pre> 291 * Organization 292 * </pre> 293 * 294 * <code>ORGANIZATION = 3;</code> 295 */ 296 public static final int ORGANIZATION_VALUE = 3; 297 /** 298 * 299 * 300 * <pre> 301 * Event 302 * </pre> 303 * 304 * <code>EVENT = 4;</code> 305 */ 306 public static final int EVENT_VALUE = 4; 307 /** 308 * 309 * 310 * <pre> 311 * Artwork 312 * </pre> 313 * 314 * <code>WORK_OF_ART = 5;</code> 315 */ 316 public static final int WORK_OF_ART_VALUE = 5; 317 /** 318 * 319 * 320 * <pre> 321 * Consumer product 322 * </pre> 323 * 324 * <code>CONSUMER_GOOD = 6;</code> 325 */ 326 public static final int CONSUMER_GOOD_VALUE = 6; 327 /** 328 * 329 * 330 * <pre> 331 * Other types of entities 332 * </pre> 333 * 334 * <code>OTHER = 7;</code> 335 */ 336 public static final int OTHER_VALUE = 7; 337 /** 338 * 339 * 340 * <pre> 341 * Phone number 342 * The metadata lists the phone number, formatted according to local 343 * convention, plus whichever additional elements appear in the text: 344 * * `number` - the actual number, broken down into sections as per local 345 * convention 346 * * `national_prefix` - country code, if detected 347 * * `area_code` - region or area code, if detected 348 * * `extension` - phone extension (to be dialed after connection), if 349 * detected 350 * </pre> 351 * 352 * <code>PHONE_NUMBER = 9;</code> 353 */ 354 public static final int PHONE_NUMBER_VALUE = 9; 355 /** 356 * 357 * 358 * <pre> 359 * Address 360 * The metadata identifies the street number and locality plus whichever 361 * additional elements appear in the text: 362 * * `street_number` - street number 363 * * `locality` - city or town 364 * * `street_name` - street/route name, if detected 365 * * `postal_code` - postal code, if detected 366 * * `country` - country, if detected< 367 * * `broad_region` - administrative area, such as the state, if detected 368 * * `narrow_region` - smaller administrative area, such as county, if 369 * detected 370 * * `sublocality` - used in Asian addresses to demark a district within a 371 * city, if detected 372 * </pre> 373 * 374 * <code>ADDRESS = 10;</code> 375 */ 376 public static final int ADDRESS_VALUE = 10; 377 /** 378 * 379 * 380 * <pre> 381 * Date 382 * The metadata identifies the components of the date: 383 * * `year` - four digit year, if detected 384 * * `month` - two digit month number, if detected 385 * * `day` - two digit day number, if detected 386 * </pre> 387 * 388 * <code>DATE = 11;</code> 389 */ 390 public static final int DATE_VALUE = 11; 391 /** 392 * 393 * 394 * <pre> 395 * Number 396 * The metadata is the number itself. 397 * </pre> 398 * 399 * <code>NUMBER = 12;</code> 400 */ 401 public static final int NUMBER_VALUE = 12; 402 /** 403 * 404 * 405 * <pre> 406 * Price 407 * The metadata identifies the `value` and `currency`. 408 * </pre> 409 * 410 * <code>PRICE = 13;</code> 411 */ 412 public static final int PRICE_VALUE = 13; 413 getNumber()414 public final int getNumber() { 415 if (this == UNRECOGNIZED) { 416 throw new java.lang.IllegalArgumentException( 417 "Can't get the number of an unknown enum value."); 418 } 419 return value; 420 } 421 422 /** 423 * @param value The numeric wire value of the corresponding enum entry. 424 * @return The enum associated with the given numeric wire value. 425 * @deprecated Use {@link #forNumber(int)} instead. 426 */ 427 @java.lang.Deprecated valueOf(int value)428 public static Type valueOf(int value) { 429 return forNumber(value); 430 } 431 432 /** 433 * @param value The numeric wire value of the corresponding enum entry. 434 * @return The enum associated with the given numeric wire value. 435 */ forNumber(int value)436 public static Type forNumber(int value) { 437 switch (value) { 438 case 0: 439 return UNKNOWN; 440 case 1: 441 return PERSON; 442 case 2: 443 return LOCATION; 444 case 3: 445 return ORGANIZATION; 446 case 4: 447 return EVENT; 448 case 5: 449 return WORK_OF_ART; 450 case 6: 451 return CONSUMER_GOOD; 452 case 7: 453 return OTHER; 454 case 9: 455 return PHONE_NUMBER; 456 case 10: 457 return ADDRESS; 458 case 11: 459 return DATE; 460 case 12: 461 return NUMBER; 462 case 13: 463 return PRICE; 464 default: 465 return null; 466 } 467 } 468 internalGetValueMap()469 public static com.google.protobuf.Internal.EnumLiteMap<Type> internalGetValueMap() { 470 return internalValueMap; 471 } 472 473 private static final com.google.protobuf.Internal.EnumLiteMap<Type> internalValueMap = 474 new com.google.protobuf.Internal.EnumLiteMap<Type>() { 475 public Type findValueByNumber(int number) { 476 return Type.forNumber(number); 477 } 478 }; 479 getValueDescriptor()480 public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { 481 if (this == UNRECOGNIZED) { 482 throw new java.lang.IllegalStateException( 483 "Can't get the descriptor of an unrecognized enum value."); 484 } 485 return getDescriptor().getValues().get(ordinal()); 486 } 487 getDescriptorForType()488 public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { 489 return getDescriptor(); 490 } 491 getDescriptor()492 public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { 493 return com.google.cloud.language.v1beta2.Entity.getDescriptor().getEnumTypes().get(0); 494 } 495 496 private static final Type[] VALUES = values(); 497 valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc)498 public static Type valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { 499 if (desc.getType() != getDescriptor()) { 500 throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); 501 } 502 if (desc.getIndex() == -1) { 503 return UNRECOGNIZED; 504 } 505 return VALUES[desc.getIndex()]; 506 } 507 508 private final int value; 509 Type(int value)510 private Type(int value) { 511 this.value = value; 512 } 513 514 // @@protoc_insertion_point(enum_scope:google.cloud.language.v1beta2.Entity.Type) 515 } 516 517 public static final int NAME_FIELD_NUMBER = 1; 518 519 @SuppressWarnings("serial") 520 private volatile java.lang.Object name_ = ""; 521 /** 522 * 523 * 524 * <pre> 525 * The representative name for the entity. 526 * </pre> 527 * 528 * <code>string name = 1;</code> 529 * 530 * @return The name. 531 */ 532 @java.lang.Override getName()533 public java.lang.String getName() { 534 java.lang.Object ref = name_; 535 if (ref instanceof java.lang.String) { 536 return (java.lang.String) ref; 537 } else { 538 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 539 java.lang.String s = bs.toStringUtf8(); 540 name_ = s; 541 return s; 542 } 543 } 544 /** 545 * 546 * 547 * <pre> 548 * The representative name for the entity. 549 * </pre> 550 * 551 * <code>string name = 1;</code> 552 * 553 * @return The bytes for name. 554 */ 555 @java.lang.Override getNameBytes()556 public com.google.protobuf.ByteString getNameBytes() { 557 java.lang.Object ref = name_; 558 if (ref instanceof java.lang.String) { 559 com.google.protobuf.ByteString b = 560 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 561 name_ = b; 562 return b; 563 } else { 564 return (com.google.protobuf.ByteString) ref; 565 } 566 } 567 568 public static final int TYPE_FIELD_NUMBER = 2; 569 private int type_ = 0; 570 /** 571 * 572 * 573 * <pre> 574 * The entity type. 575 * </pre> 576 * 577 * <code>.google.cloud.language.v1beta2.Entity.Type type = 2;</code> 578 * 579 * @return The enum numeric value on the wire for type. 580 */ 581 @java.lang.Override getTypeValue()582 public int getTypeValue() { 583 return type_; 584 } 585 /** 586 * 587 * 588 * <pre> 589 * The entity type. 590 * </pre> 591 * 592 * <code>.google.cloud.language.v1beta2.Entity.Type type = 2;</code> 593 * 594 * @return The type. 595 */ 596 @java.lang.Override getType()597 public com.google.cloud.language.v1beta2.Entity.Type getType() { 598 com.google.cloud.language.v1beta2.Entity.Type result = 599 com.google.cloud.language.v1beta2.Entity.Type.forNumber(type_); 600 return result == null ? com.google.cloud.language.v1beta2.Entity.Type.UNRECOGNIZED : result; 601 } 602 603 public static final int METADATA_FIELD_NUMBER = 3; 604 605 private static final class MetadataDefaultEntryHolder { 606 static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry = 607 com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance( 608 com.google.cloud.language.v1beta2.LanguageServiceProto 609 .internal_static_google_cloud_language_v1beta2_Entity_MetadataEntry_descriptor, 610 com.google.protobuf.WireFormat.FieldType.STRING, 611 "", 612 com.google.protobuf.WireFormat.FieldType.STRING, 613 ""); 614 } 615 616 @SuppressWarnings("serial") 617 private com.google.protobuf.MapField<java.lang.String, java.lang.String> metadata_; 618 internalGetMetadata()619 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetMetadata() { 620 if (metadata_ == null) { 621 return com.google.protobuf.MapField.emptyMapField(MetadataDefaultEntryHolder.defaultEntry); 622 } 623 return metadata_; 624 } 625 getMetadataCount()626 public int getMetadataCount() { 627 return internalGetMetadata().getMap().size(); 628 } 629 /** 630 * 631 * 632 * <pre> 633 * Metadata associated with the entity. 634 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 635 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 636 * associated with other entity types, see the Type table below. 637 * </pre> 638 * 639 * <code>map<string, string> metadata = 3;</code> 640 */ 641 @java.lang.Override containsMetadata(java.lang.String key)642 public boolean containsMetadata(java.lang.String key) { 643 if (key == null) { 644 throw new NullPointerException("map key"); 645 } 646 return internalGetMetadata().getMap().containsKey(key); 647 } 648 /** Use {@link #getMetadataMap()} instead. */ 649 @java.lang.Override 650 @java.lang.Deprecated getMetadata()651 public java.util.Map<java.lang.String, java.lang.String> getMetadata() { 652 return getMetadataMap(); 653 } 654 /** 655 * 656 * 657 * <pre> 658 * Metadata associated with the entity. 659 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 660 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 661 * associated with other entity types, see the Type table below. 662 * </pre> 663 * 664 * <code>map<string, string> metadata = 3;</code> 665 */ 666 @java.lang.Override getMetadataMap()667 public java.util.Map<java.lang.String, java.lang.String> getMetadataMap() { 668 return internalGetMetadata().getMap(); 669 } 670 /** 671 * 672 * 673 * <pre> 674 * Metadata associated with the entity. 675 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 676 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 677 * associated with other entity types, see the Type table below. 678 * </pre> 679 * 680 * <code>map<string, string> metadata = 3;</code> 681 */ 682 @java.lang.Override getMetadataOrDefault( java.lang.String key, java.lang.String defaultValue)683 public /* nullable */ java.lang.String getMetadataOrDefault( 684 java.lang.String key, 685 /* nullable */ 686 java.lang.String defaultValue) { 687 if (key == null) { 688 throw new NullPointerException("map key"); 689 } 690 java.util.Map<java.lang.String, java.lang.String> map = internalGetMetadata().getMap(); 691 return map.containsKey(key) ? map.get(key) : defaultValue; 692 } 693 /** 694 * 695 * 696 * <pre> 697 * Metadata associated with the entity. 698 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 699 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 700 * associated with other entity types, see the Type table below. 701 * </pre> 702 * 703 * <code>map<string, string> metadata = 3;</code> 704 */ 705 @java.lang.Override getMetadataOrThrow(java.lang.String key)706 public java.lang.String getMetadataOrThrow(java.lang.String key) { 707 if (key == null) { 708 throw new NullPointerException("map key"); 709 } 710 java.util.Map<java.lang.String, java.lang.String> map = internalGetMetadata().getMap(); 711 if (!map.containsKey(key)) { 712 throw new java.lang.IllegalArgumentException(); 713 } 714 return map.get(key); 715 } 716 717 public static final int SALIENCE_FIELD_NUMBER = 4; 718 private float salience_ = 0F; 719 /** 720 * 721 * 722 * <pre> 723 * The salience score associated with the entity in the [0, 1.0] range. 724 * The salience score for an entity provides information about the 725 * importance or centrality of that entity to the entire document text. 726 * Scores closer to 0 are less salient, while scores closer to 1.0 are highly 727 * salient. 728 * </pre> 729 * 730 * <code>float salience = 4;</code> 731 * 732 * @return The salience. 733 */ 734 @java.lang.Override getSalience()735 public float getSalience() { 736 return salience_; 737 } 738 739 public static final int MENTIONS_FIELD_NUMBER = 5; 740 741 @SuppressWarnings("serial") 742 private java.util.List<com.google.cloud.language.v1beta2.EntityMention> mentions_; 743 /** 744 * 745 * 746 * <pre> 747 * The mentions of this entity in the input document. The API currently 748 * supports proper noun mentions. 749 * </pre> 750 * 751 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 752 */ 753 @java.lang.Override getMentionsList()754 public java.util.List<com.google.cloud.language.v1beta2.EntityMention> getMentionsList() { 755 return mentions_; 756 } 757 /** 758 * 759 * 760 * <pre> 761 * The mentions of this entity in the input document. The API currently 762 * supports proper noun mentions. 763 * </pre> 764 * 765 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 766 */ 767 @java.lang.Override 768 public java.util.List<? extends com.google.cloud.language.v1beta2.EntityMentionOrBuilder> getMentionsOrBuilderList()769 getMentionsOrBuilderList() { 770 return mentions_; 771 } 772 /** 773 * 774 * 775 * <pre> 776 * The mentions of this entity in the input document. The API currently 777 * supports proper noun mentions. 778 * </pre> 779 * 780 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 781 */ 782 @java.lang.Override getMentionsCount()783 public int getMentionsCount() { 784 return mentions_.size(); 785 } 786 /** 787 * 788 * 789 * <pre> 790 * The mentions of this entity in the input document. The API currently 791 * supports proper noun mentions. 792 * </pre> 793 * 794 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 795 */ 796 @java.lang.Override getMentions(int index)797 public com.google.cloud.language.v1beta2.EntityMention getMentions(int index) { 798 return mentions_.get(index); 799 } 800 /** 801 * 802 * 803 * <pre> 804 * The mentions of this entity in the input document. The API currently 805 * supports proper noun mentions. 806 * </pre> 807 * 808 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 809 */ 810 @java.lang.Override getMentionsOrBuilder(int index)811 public com.google.cloud.language.v1beta2.EntityMentionOrBuilder getMentionsOrBuilder(int index) { 812 return mentions_.get(index); 813 } 814 815 public static final int SENTIMENT_FIELD_NUMBER = 6; 816 private com.google.cloud.language.v1beta2.Sentiment sentiment_; 817 /** 818 * 819 * 820 * <pre> 821 * For calls to [AnalyzeEntitySentiment][] or if 822 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 823 * true, this field will contain the aggregate sentiment expressed for this 824 * entity in the provided document. 825 * </pre> 826 * 827 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 828 * 829 * @return Whether the sentiment field is set. 830 */ 831 @java.lang.Override hasSentiment()832 public boolean hasSentiment() { 833 return sentiment_ != null; 834 } 835 /** 836 * 837 * 838 * <pre> 839 * For calls to [AnalyzeEntitySentiment][] or if 840 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 841 * true, this field will contain the aggregate sentiment expressed for this 842 * entity in the provided document. 843 * </pre> 844 * 845 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 846 * 847 * @return The sentiment. 848 */ 849 @java.lang.Override getSentiment()850 public com.google.cloud.language.v1beta2.Sentiment getSentiment() { 851 return sentiment_ == null 852 ? com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance() 853 : sentiment_; 854 } 855 /** 856 * 857 * 858 * <pre> 859 * For calls to [AnalyzeEntitySentiment][] or if 860 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 861 * true, this field will contain the aggregate sentiment expressed for this 862 * entity in the provided document. 863 * </pre> 864 * 865 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 866 */ 867 @java.lang.Override getSentimentOrBuilder()868 public com.google.cloud.language.v1beta2.SentimentOrBuilder getSentimentOrBuilder() { 869 return sentiment_ == null 870 ? com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance() 871 : sentiment_; 872 } 873 874 private byte memoizedIsInitialized = -1; 875 876 @java.lang.Override isInitialized()877 public final boolean isInitialized() { 878 byte isInitialized = memoizedIsInitialized; 879 if (isInitialized == 1) return true; 880 if (isInitialized == 0) return false; 881 882 memoizedIsInitialized = 1; 883 return true; 884 } 885 886 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)887 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 888 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { 889 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); 890 } 891 if (type_ != com.google.cloud.language.v1beta2.Entity.Type.UNKNOWN.getNumber()) { 892 output.writeEnum(2, type_); 893 } 894 com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( 895 output, internalGetMetadata(), MetadataDefaultEntryHolder.defaultEntry, 3); 896 if (java.lang.Float.floatToRawIntBits(salience_) != 0) { 897 output.writeFloat(4, salience_); 898 } 899 for (int i = 0; i < mentions_.size(); i++) { 900 output.writeMessage(5, mentions_.get(i)); 901 } 902 if (sentiment_ != null) { 903 output.writeMessage(6, getSentiment()); 904 } 905 getUnknownFields().writeTo(output); 906 } 907 908 @java.lang.Override getSerializedSize()909 public int getSerializedSize() { 910 int size = memoizedSize; 911 if (size != -1) return size; 912 913 size = 0; 914 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { 915 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); 916 } 917 if (type_ != com.google.cloud.language.v1beta2.Entity.Type.UNKNOWN.getNumber()) { 918 size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, type_); 919 } 920 for (java.util.Map.Entry<java.lang.String, java.lang.String> entry : 921 internalGetMetadata().getMap().entrySet()) { 922 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> metadata__ = 923 MetadataDefaultEntryHolder.defaultEntry 924 .newBuilderForType() 925 .setKey(entry.getKey()) 926 .setValue(entry.getValue()) 927 .build(); 928 size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, metadata__); 929 } 930 if (java.lang.Float.floatToRawIntBits(salience_) != 0) { 931 size += com.google.protobuf.CodedOutputStream.computeFloatSize(4, salience_); 932 } 933 for (int i = 0; i < mentions_.size(); i++) { 934 size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, mentions_.get(i)); 935 } 936 if (sentiment_ != null) { 937 size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getSentiment()); 938 } 939 size += getUnknownFields().getSerializedSize(); 940 memoizedSize = size; 941 return size; 942 } 943 944 @java.lang.Override equals(final java.lang.Object obj)945 public boolean equals(final java.lang.Object obj) { 946 if (obj == this) { 947 return true; 948 } 949 if (!(obj instanceof com.google.cloud.language.v1beta2.Entity)) { 950 return super.equals(obj); 951 } 952 com.google.cloud.language.v1beta2.Entity other = (com.google.cloud.language.v1beta2.Entity) obj; 953 954 if (!getName().equals(other.getName())) return false; 955 if (type_ != other.type_) return false; 956 if (!internalGetMetadata().equals(other.internalGetMetadata())) return false; 957 if (java.lang.Float.floatToIntBits(getSalience()) 958 != java.lang.Float.floatToIntBits(other.getSalience())) return false; 959 if (!getMentionsList().equals(other.getMentionsList())) return false; 960 if (hasSentiment() != other.hasSentiment()) return false; 961 if (hasSentiment()) { 962 if (!getSentiment().equals(other.getSentiment())) return false; 963 } 964 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 965 return true; 966 } 967 968 @java.lang.Override hashCode()969 public int hashCode() { 970 if (memoizedHashCode != 0) { 971 return memoizedHashCode; 972 } 973 int hash = 41; 974 hash = (19 * hash) + getDescriptor().hashCode(); 975 hash = (37 * hash) + NAME_FIELD_NUMBER; 976 hash = (53 * hash) + getName().hashCode(); 977 hash = (37 * hash) + TYPE_FIELD_NUMBER; 978 hash = (53 * hash) + type_; 979 if (!internalGetMetadata().getMap().isEmpty()) { 980 hash = (37 * hash) + METADATA_FIELD_NUMBER; 981 hash = (53 * hash) + internalGetMetadata().hashCode(); 982 } 983 hash = (37 * hash) + SALIENCE_FIELD_NUMBER; 984 hash = (53 * hash) + java.lang.Float.floatToIntBits(getSalience()); 985 if (getMentionsCount() > 0) { 986 hash = (37 * hash) + MENTIONS_FIELD_NUMBER; 987 hash = (53 * hash) + getMentionsList().hashCode(); 988 } 989 if (hasSentiment()) { 990 hash = (37 * hash) + SENTIMENT_FIELD_NUMBER; 991 hash = (53 * hash) + getSentiment().hashCode(); 992 } 993 hash = (29 * hash) + getUnknownFields().hashCode(); 994 memoizedHashCode = hash; 995 return hash; 996 } 997 parseFrom(java.nio.ByteBuffer data)998 public static com.google.cloud.language.v1beta2.Entity parseFrom(java.nio.ByteBuffer data) 999 throws com.google.protobuf.InvalidProtocolBufferException { 1000 return PARSER.parseFrom(data); 1001 } 1002 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1003 public static com.google.cloud.language.v1beta2.Entity parseFrom( 1004 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1005 throws com.google.protobuf.InvalidProtocolBufferException { 1006 return PARSER.parseFrom(data, extensionRegistry); 1007 } 1008 parseFrom( com.google.protobuf.ByteString data)1009 public static com.google.cloud.language.v1beta2.Entity parseFrom( 1010 com.google.protobuf.ByteString data) 1011 throws com.google.protobuf.InvalidProtocolBufferException { 1012 return PARSER.parseFrom(data); 1013 } 1014 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1015 public static com.google.cloud.language.v1beta2.Entity parseFrom( 1016 com.google.protobuf.ByteString data, 1017 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1018 throws com.google.protobuf.InvalidProtocolBufferException { 1019 return PARSER.parseFrom(data, extensionRegistry); 1020 } 1021 parseFrom(byte[] data)1022 public static com.google.cloud.language.v1beta2.Entity parseFrom(byte[] data) 1023 throws com.google.protobuf.InvalidProtocolBufferException { 1024 return PARSER.parseFrom(data); 1025 } 1026 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1027 public static com.google.cloud.language.v1beta2.Entity parseFrom( 1028 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1029 throws com.google.protobuf.InvalidProtocolBufferException { 1030 return PARSER.parseFrom(data, extensionRegistry); 1031 } 1032 parseFrom(java.io.InputStream input)1033 public static com.google.cloud.language.v1beta2.Entity parseFrom(java.io.InputStream input) 1034 throws java.io.IOException { 1035 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 1036 } 1037 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1038 public static com.google.cloud.language.v1beta2.Entity parseFrom( 1039 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1040 throws java.io.IOException { 1041 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 1042 PARSER, input, extensionRegistry); 1043 } 1044 parseDelimitedFrom( java.io.InputStream input)1045 public static com.google.cloud.language.v1beta2.Entity parseDelimitedFrom( 1046 java.io.InputStream input) throws java.io.IOException { 1047 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 1048 } 1049 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1050 public static com.google.cloud.language.v1beta2.Entity parseDelimitedFrom( 1051 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1052 throws java.io.IOException { 1053 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 1054 PARSER, input, extensionRegistry); 1055 } 1056 parseFrom( com.google.protobuf.CodedInputStream input)1057 public static com.google.cloud.language.v1beta2.Entity parseFrom( 1058 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 1059 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 1060 } 1061 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1062 public static com.google.cloud.language.v1beta2.Entity parseFrom( 1063 com.google.protobuf.CodedInputStream input, 1064 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1065 throws java.io.IOException { 1066 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 1067 PARSER, input, extensionRegistry); 1068 } 1069 1070 @java.lang.Override newBuilderForType()1071 public Builder newBuilderForType() { 1072 return newBuilder(); 1073 } 1074 newBuilder()1075 public static Builder newBuilder() { 1076 return DEFAULT_INSTANCE.toBuilder(); 1077 } 1078 newBuilder(com.google.cloud.language.v1beta2.Entity prototype)1079 public static Builder newBuilder(com.google.cloud.language.v1beta2.Entity prototype) { 1080 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 1081 } 1082 1083 @java.lang.Override toBuilder()1084 public Builder toBuilder() { 1085 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 1086 } 1087 1088 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)1089 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1090 Builder builder = new Builder(parent); 1091 return builder; 1092 } 1093 /** 1094 * 1095 * 1096 * <pre> 1097 * Represents a phrase in the text that is a known entity, such as 1098 * a person, an organization, or location. The API associates information, such 1099 * as salience and mentions, with entities. 1100 * </pre> 1101 * 1102 * Protobuf type {@code google.cloud.language.v1beta2.Entity} 1103 */ 1104 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 1105 implements 1106 // @@protoc_insertion_point(builder_implements:google.cloud.language.v1beta2.Entity) 1107 com.google.cloud.language.v1beta2.EntityOrBuilder { getDescriptor()1108 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 1109 return com.google.cloud.language.v1beta2.LanguageServiceProto 1110 .internal_static_google_cloud_language_v1beta2_Entity_descriptor; 1111 } 1112 1113 @SuppressWarnings({"rawtypes"}) internalGetMapField(int number)1114 protected com.google.protobuf.MapField internalGetMapField(int number) { 1115 switch (number) { 1116 case 3: 1117 return internalGetMetadata(); 1118 default: 1119 throw new RuntimeException("Invalid map field number: " + number); 1120 } 1121 } 1122 1123 @SuppressWarnings({"rawtypes"}) internalGetMutableMapField(int number)1124 protected com.google.protobuf.MapField internalGetMutableMapField(int number) { 1125 switch (number) { 1126 case 3: 1127 return internalGetMutableMetadata(); 1128 default: 1129 throw new RuntimeException("Invalid map field number: " + number); 1130 } 1131 } 1132 1133 @java.lang.Override 1134 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()1135 internalGetFieldAccessorTable() { 1136 return com.google.cloud.language.v1beta2.LanguageServiceProto 1137 .internal_static_google_cloud_language_v1beta2_Entity_fieldAccessorTable 1138 .ensureFieldAccessorsInitialized( 1139 com.google.cloud.language.v1beta2.Entity.class, 1140 com.google.cloud.language.v1beta2.Entity.Builder.class); 1141 } 1142 1143 // Construct using com.google.cloud.language.v1beta2.Entity.newBuilder() Builder()1144 private Builder() {} 1145 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)1146 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1147 super(parent); 1148 } 1149 1150 @java.lang.Override clear()1151 public Builder clear() { 1152 super.clear(); 1153 bitField0_ = 0; 1154 name_ = ""; 1155 type_ = 0; 1156 internalGetMutableMetadata().clear(); 1157 salience_ = 0F; 1158 if (mentionsBuilder_ == null) { 1159 mentions_ = java.util.Collections.emptyList(); 1160 } else { 1161 mentions_ = null; 1162 mentionsBuilder_.clear(); 1163 } 1164 bitField0_ = (bitField0_ & ~0x00000010); 1165 sentiment_ = null; 1166 if (sentimentBuilder_ != null) { 1167 sentimentBuilder_.dispose(); 1168 sentimentBuilder_ = null; 1169 } 1170 return this; 1171 } 1172 1173 @java.lang.Override getDescriptorForType()1174 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 1175 return com.google.cloud.language.v1beta2.LanguageServiceProto 1176 .internal_static_google_cloud_language_v1beta2_Entity_descriptor; 1177 } 1178 1179 @java.lang.Override getDefaultInstanceForType()1180 public com.google.cloud.language.v1beta2.Entity getDefaultInstanceForType() { 1181 return com.google.cloud.language.v1beta2.Entity.getDefaultInstance(); 1182 } 1183 1184 @java.lang.Override build()1185 public com.google.cloud.language.v1beta2.Entity build() { 1186 com.google.cloud.language.v1beta2.Entity result = buildPartial(); 1187 if (!result.isInitialized()) { 1188 throw newUninitializedMessageException(result); 1189 } 1190 return result; 1191 } 1192 1193 @java.lang.Override buildPartial()1194 public com.google.cloud.language.v1beta2.Entity buildPartial() { 1195 com.google.cloud.language.v1beta2.Entity result = 1196 new com.google.cloud.language.v1beta2.Entity(this); 1197 buildPartialRepeatedFields(result); 1198 if (bitField0_ != 0) { 1199 buildPartial0(result); 1200 } 1201 onBuilt(); 1202 return result; 1203 } 1204 buildPartialRepeatedFields(com.google.cloud.language.v1beta2.Entity result)1205 private void buildPartialRepeatedFields(com.google.cloud.language.v1beta2.Entity result) { 1206 if (mentionsBuilder_ == null) { 1207 if (((bitField0_ & 0x00000010) != 0)) { 1208 mentions_ = java.util.Collections.unmodifiableList(mentions_); 1209 bitField0_ = (bitField0_ & ~0x00000010); 1210 } 1211 result.mentions_ = mentions_; 1212 } else { 1213 result.mentions_ = mentionsBuilder_.build(); 1214 } 1215 } 1216 buildPartial0(com.google.cloud.language.v1beta2.Entity result)1217 private void buildPartial0(com.google.cloud.language.v1beta2.Entity result) { 1218 int from_bitField0_ = bitField0_; 1219 if (((from_bitField0_ & 0x00000001) != 0)) { 1220 result.name_ = name_; 1221 } 1222 if (((from_bitField0_ & 0x00000002) != 0)) { 1223 result.type_ = type_; 1224 } 1225 if (((from_bitField0_ & 0x00000004) != 0)) { 1226 result.metadata_ = internalGetMetadata(); 1227 result.metadata_.makeImmutable(); 1228 } 1229 if (((from_bitField0_ & 0x00000008) != 0)) { 1230 result.salience_ = salience_; 1231 } 1232 if (((from_bitField0_ & 0x00000020) != 0)) { 1233 result.sentiment_ = sentimentBuilder_ == null ? sentiment_ : sentimentBuilder_.build(); 1234 } 1235 } 1236 1237 @java.lang.Override clone()1238 public Builder clone() { 1239 return super.clone(); 1240 } 1241 1242 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)1243 public Builder setField( 1244 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 1245 return super.setField(field, value); 1246 } 1247 1248 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)1249 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 1250 return super.clearField(field); 1251 } 1252 1253 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)1254 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 1255 return super.clearOneof(oneof); 1256 } 1257 1258 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)1259 public Builder setRepeatedField( 1260 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 1261 return super.setRepeatedField(field, index, value); 1262 } 1263 1264 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)1265 public Builder addRepeatedField( 1266 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 1267 return super.addRepeatedField(field, value); 1268 } 1269 1270 @java.lang.Override mergeFrom(com.google.protobuf.Message other)1271 public Builder mergeFrom(com.google.protobuf.Message other) { 1272 if (other instanceof com.google.cloud.language.v1beta2.Entity) { 1273 return mergeFrom((com.google.cloud.language.v1beta2.Entity) other); 1274 } else { 1275 super.mergeFrom(other); 1276 return this; 1277 } 1278 } 1279 mergeFrom(com.google.cloud.language.v1beta2.Entity other)1280 public Builder mergeFrom(com.google.cloud.language.v1beta2.Entity other) { 1281 if (other == com.google.cloud.language.v1beta2.Entity.getDefaultInstance()) return this; 1282 if (!other.getName().isEmpty()) { 1283 name_ = other.name_; 1284 bitField0_ |= 0x00000001; 1285 onChanged(); 1286 } 1287 if (other.type_ != 0) { 1288 setTypeValue(other.getTypeValue()); 1289 } 1290 internalGetMutableMetadata().mergeFrom(other.internalGetMetadata()); 1291 bitField0_ |= 0x00000004; 1292 if (other.getSalience() != 0F) { 1293 setSalience(other.getSalience()); 1294 } 1295 if (mentionsBuilder_ == null) { 1296 if (!other.mentions_.isEmpty()) { 1297 if (mentions_.isEmpty()) { 1298 mentions_ = other.mentions_; 1299 bitField0_ = (bitField0_ & ~0x00000010); 1300 } else { 1301 ensureMentionsIsMutable(); 1302 mentions_.addAll(other.mentions_); 1303 } 1304 onChanged(); 1305 } 1306 } else { 1307 if (!other.mentions_.isEmpty()) { 1308 if (mentionsBuilder_.isEmpty()) { 1309 mentionsBuilder_.dispose(); 1310 mentionsBuilder_ = null; 1311 mentions_ = other.mentions_; 1312 bitField0_ = (bitField0_ & ~0x00000010); 1313 mentionsBuilder_ = 1314 com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders 1315 ? getMentionsFieldBuilder() 1316 : null; 1317 } else { 1318 mentionsBuilder_.addAllMessages(other.mentions_); 1319 } 1320 } 1321 } 1322 if (other.hasSentiment()) { 1323 mergeSentiment(other.getSentiment()); 1324 } 1325 this.mergeUnknownFields(other.getUnknownFields()); 1326 onChanged(); 1327 return this; 1328 } 1329 1330 @java.lang.Override isInitialized()1331 public final boolean isInitialized() { 1332 return true; 1333 } 1334 1335 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1336 public Builder mergeFrom( 1337 com.google.protobuf.CodedInputStream input, 1338 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1339 throws java.io.IOException { 1340 if (extensionRegistry == null) { 1341 throw new java.lang.NullPointerException(); 1342 } 1343 try { 1344 boolean done = false; 1345 while (!done) { 1346 int tag = input.readTag(); 1347 switch (tag) { 1348 case 0: 1349 done = true; 1350 break; 1351 case 10: 1352 { 1353 name_ = input.readStringRequireUtf8(); 1354 bitField0_ |= 0x00000001; 1355 break; 1356 } // case 10 1357 case 16: 1358 { 1359 type_ = input.readEnum(); 1360 bitField0_ |= 0x00000002; 1361 break; 1362 } // case 16 1363 case 26: 1364 { 1365 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> metadata__ = 1366 input.readMessage( 1367 MetadataDefaultEntryHolder.defaultEntry.getParserForType(), 1368 extensionRegistry); 1369 internalGetMutableMetadata() 1370 .getMutableMap() 1371 .put(metadata__.getKey(), metadata__.getValue()); 1372 bitField0_ |= 0x00000004; 1373 break; 1374 } // case 26 1375 case 37: 1376 { 1377 salience_ = input.readFloat(); 1378 bitField0_ |= 0x00000008; 1379 break; 1380 } // case 37 1381 case 42: 1382 { 1383 com.google.cloud.language.v1beta2.EntityMention m = 1384 input.readMessage( 1385 com.google.cloud.language.v1beta2.EntityMention.parser(), 1386 extensionRegistry); 1387 if (mentionsBuilder_ == null) { 1388 ensureMentionsIsMutable(); 1389 mentions_.add(m); 1390 } else { 1391 mentionsBuilder_.addMessage(m); 1392 } 1393 break; 1394 } // case 42 1395 case 50: 1396 { 1397 input.readMessage(getSentimentFieldBuilder().getBuilder(), extensionRegistry); 1398 bitField0_ |= 0x00000020; 1399 break; 1400 } // case 50 1401 default: 1402 { 1403 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 1404 done = true; // was an endgroup tag 1405 } 1406 break; 1407 } // default: 1408 } // switch (tag) 1409 } // while (!done) 1410 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1411 throw e.unwrapIOException(); 1412 } finally { 1413 onChanged(); 1414 } // finally 1415 return this; 1416 } 1417 1418 private int bitField0_; 1419 1420 private java.lang.Object name_ = ""; 1421 /** 1422 * 1423 * 1424 * <pre> 1425 * The representative name for the entity. 1426 * </pre> 1427 * 1428 * <code>string name = 1;</code> 1429 * 1430 * @return The name. 1431 */ getName()1432 public java.lang.String getName() { 1433 java.lang.Object ref = name_; 1434 if (!(ref instanceof java.lang.String)) { 1435 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1436 java.lang.String s = bs.toStringUtf8(); 1437 name_ = s; 1438 return s; 1439 } else { 1440 return (java.lang.String) ref; 1441 } 1442 } 1443 /** 1444 * 1445 * 1446 * <pre> 1447 * The representative name for the entity. 1448 * </pre> 1449 * 1450 * <code>string name = 1;</code> 1451 * 1452 * @return The bytes for name. 1453 */ getNameBytes()1454 public com.google.protobuf.ByteString getNameBytes() { 1455 java.lang.Object ref = name_; 1456 if (ref instanceof String) { 1457 com.google.protobuf.ByteString b = 1458 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1459 name_ = b; 1460 return b; 1461 } else { 1462 return (com.google.protobuf.ByteString) ref; 1463 } 1464 } 1465 /** 1466 * 1467 * 1468 * <pre> 1469 * The representative name for the entity. 1470 * </pre> 1471 * 1472 * <code>string name = 1;</code> 1473 * 1474 * @param value The name to set. 1475 * @return This builder for chaining. 1476 */ setName(java.lang.String value)1477 public Builder setName(java.lang.String value) { 1478 if (value == null) { 1479 throw new NullPointerException(); 1480 } 1481 name_ = value; 1482 bitField0_ |= 0x00000001; 1483 onChanged(); 1484 return this; 1485 } 1486 /** 1487 * 1488 * 1489 * <pre> 1490 * The representative name for the entity. 1491 * </pre> 1492 * 1493 * <code>string name = 1;</code> 1494 * 1495 * @return This builder for chaining. 1496 */ clearName()1497 public Builder clearName() { 1498 name_ = getDefaultInstance().getName(); 1499 bitField0_ = (bitField0_ & ~0x00000001); 1500 onChanged(); 1501 return this; 1502 } 1503 /** 1504 * 1505 * 1506 * <pre> 1507 * The representative name for the entity. 1508 * </pre> 1509 * 1510 * <code>string name = 1;</code> 1511 * 1512 * @param value The bytes for name to set. 1513 * @return This builder for chaining. 1514 */ setNameBytes(com.google.protobuf.ByteString value)1515 public Builder setNameBytes(com.google.protobuf.ByteString value) { 1516 if (value == null) { 1517 throw new NullPointerException(); 1518 } 1519 checkByteStringIsUtf8(value); 1520 name_ = value; 1521 bitField0_ |= 0x00000001; 1522 onChanged(); 1523 return this; 1524 } 1525 1526 private int type_ = 0; 1527 /** 1528 * 1529 * 1530 * <pre> 1531 * The entity type. 1532 * </pre> 1533 * 1534 * <code>.google.cloud.language.v1beta2.Entity.Type type = 2;</code> 1535 * 1536 * @return The enum numeric value on the wire for type. 1537 */ 1538 @java.lang.Override getTypeValue()1539 public int getTypeValue() { 1540 return type_; 1541 } 1542 /** 1543 * 1544 * 1545 * <pre> 1546 * The entity type. 1547 * </pre> 1548 * 1549 * <code>.google.cloud.language.v1beta2.Entity.Type type = 2;</code> 1550 * 1551 * @param value The enum numeric value on the wire for type to set. 1552 * @return This builder for chaining. 1553 */ setTypeValue(int value)1554 public Builder setTypeValue(int value) { 1555 type_ = value; 1556 bitField0_ |= 0x00000002; 1557 onChanged(); 1558 return this; 1559 } 1560 /** 1561 * 1562 * 1563 * <pre> 1564 * The entity type. 1565 * </pre> 1566 * 1567 * <code>.google.cloud.language.v1beta2.Entity.Type type = 2;</code> 1568 * 1569 * @return The type. 1570 */ 1571 @java.lang.Override getType()1572 public com.google.cloud.language.v1beta2.Entity.Type getType() { 1573 com.google.cloud.language.v1beta2.Entity.Type result = 1574 com.google.cloud.language.v1beta2.Entity.Type.forNumber(type_); 1575 return result == null ? com.google.cloud.language.v1beta2.Entity.Type.UNRECOGNIZED : result; 1576 } 1577 /** 1578 * 1579 * 1580 * <pre> 1581 * The entity type. 1582 * </pre> 1583 * 1584 * <code>.google.cloud.language.v1beta2.Entity.Type type = 2;</code> 1585 * 1586 * @param value The type to set. 1587 * @return This builder for chaining. 1588 */ setType(com.google.cloud.language.v1beta2.Entity.Type value)1589 public Builder setType(com.google.cloud.language.v1beta2.Entity.Type value) { 1590 if (value == null) { 1591 throw new NullPointerException(); 1592 } 1593 bitField0_ |= 0x00000002; 1594 type_ = value.getNumber(); 1595 onChanged(); 1596 return this; 1597 } 1598 /** 1599 * 1600 * 1601 * <pre> 1602 * The entity type. 1603 * </pre> 1604 * 1605 * <code>.google.cloud.language.v1beta2.Entity.Type type = 2;</code> 1606 * 1607 * @return This builder for chaining. 1608 */ clearType()1609 public Builder clearType() { 1610 bitField0_ = (bitField0_ & ~0x00000002); 1611 type_ = 0; 1612 onChanged(); 1613 return this; 1614 } 1615 1616 private com.google.protobuf.MapField<java.lang.String, java.lang.String> metadata_; 1617 internalGetMetadata()1618 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetMetadata() { 1619 if (metadata_ == null) { 1620 return com.google.protobuf.MapField.emptyMapField(MetadataDefaultEntryHolder.defaultEntry); 1621 } 1622 return metadata_; 1623 } 1624 1625 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetMutableMetadata()1626 internalGetMutableMetadata() { 1627 if (metadata_ == null) { 1628 metadata_ = 1629 com.google.protobuf.MapField.newMapField(MetadataDefaultEntryHolder.defaultEntry); 1630 } 1631 if (!metadata_.isMutable()) { 1632 metadata_ = metadata_.copy(); 1633 } 1634 bitField0_ |= 0x00000004; 1635 onChanged(); 1636 return metadata_; 1637 } 1638 getMetadataCount()1639 public int getMetadataCount() { 1640 return internalGetMetadata().getMap().size(); 1641 } 1642 /** 1643 * 1644 * 1645 * <pre> 1646 * Metadata associated with the entity. 1647 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 1648 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 1649 * associated with other entity types, see the Type table below. 1650 * </pre> 1651 * 1652 * <code>map<string, string> metadata = 3;</code> 1653 */ 1654 @java.lang.Override containsMetadata(java.lang.String key)1655 public boolean containsMetadata(java.lang.String key) { 1656 if (key == null) { 1657 throw new NullPointerException("map key"); 1658 } 1659 return internalGetMetadata().getMap().containsKey(key); 1660 } 1661 /** Use {@link #getMetadataMap()} instead. */ 1662 @java.lang.Override 1663 @java.lang.Deprecated getMetadata()1664 public java.util.Map<java.lang.String, java.lang.String> getMetadata() { 1665 return getMetadataMap(); 1666 } 1667 /** 1668 * 1669 * 1670 * <pre> 1671 * Metadata associated with the entity. 1672 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 1673 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 1674 * associated with other entity types, see the Type table below. 1675 * </pre> 1676 * 1677 * <code>map<string, string> metadata = 3;</code> 1678 */ 1679 @java.lang.Override getMetadataMap()1680 public java.util.Map<java.lang.String, java.lang.String> getMetadataMap() { 1681 return internalGetMetadata().getMap(); 1682 } 1683 /** 1684 * 1685 * 1686 * <pre> 1687 * Metadata associated with the entity. 1688 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 1689 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 1690 * associated with other entity types, see the Type table below. 1691 * </pre> 1692 * 1693 * <code>map<string, string> metadata = 3;</code> 1694 */ 1695 @java.lang.Override getMetadataOrDefault( java.lang.String key, java.lang.String defaultValue)1696 public /* nullable */ java.lang.String getMetadataOrDefault( 1697 java.lang.String key, 1698 /* nullable */ 1699 java.lang.String defaultValue) { 1700 if (key == null) { 1701 throw new NullPointerException("map key"); 1702 } 1703 java.util.Map<java.lang.String, java.lang.String> map = internalGetMetadata().getMap(); 1704 return map.containsKey(key) ? map.get(key) : defaultValue; 1705 } 1706 /** 1707 * 1708 * 1709 * <pre> 1710 * Metadata associated with the entity. 1711 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 1712 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 1713 * associated with other entity types, see the Type table below. 1714 * </pre> 1715 * 1716 * <code>map<string, string> metadata = 3;</code> 1717 */ 1718 @java.lang.Override getMetadataOrThrow(java.lang.String key)1719 public java.lang.String getMetadataOrThrow(java.lang.String key) { 1720 if (key == null) { 1721 throw new NullPointerException("map key"); 1722 } 1723 java.util.Map<java.lang.String, java.lang.String> map = internalGetMetadata().getMap(); 1724 if (!map.containsKey(key)) { 1725 throw new java.lang.IllegalArgumentException(); 1726 } 1727 return map.get(key); 1728 } 1729 clearMetadata()1730 public Builder clearMetadata() { 1731 bitField0_ = (bitField0_ & ~0x00000004); 1732 internalGetMutableMetadata().getMutableMap().clear(); 1733 return this; 1734 } 1735 /** 1736 * 1737 * 1738 * <pre> 1739 * Metadata associated with the entity. 1740 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 1741 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 1742 * associated with other entity types, see the Type table below. 1743 * </pre> 1744 * 1745 * <code>map<string, string> metadata = 3;</code> 1746 */ removeMetadata(java.lang.String key)1747 public Builder removeMetadata(java.lang.String key) { 1748 if (key == null) { 1749 throw new NullPointerException("map key"); 1750 } 1751 internalGetMutableMetadata().getMutableMap().remove(key); 1752 return this; 1753 } 1754 /** Use alternate mutation accessors instead. */ 1755 @java.lang.Deprecated getMutableMetadata()1756 public java.util.Map<java.lang.String, java.lang.String> getMutableMetadata() { 1757 bitField0_ |= 0x00000004; 1758 return internalGetMutableMetadata().getMutableMap(); 1759 } 1760 /** 1761 * 1762 * 1763 * <pre> 1764 * Metadata associated with the entity. 1765 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 1766 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 1767 * associated with other entity types, see the Type table below. 1768 * </pre> 1769 * 1770 * <code>map<string, string> metadata = 3;</code> 1771 */ putMetadata(java.lang.String key, java.lang.String value)1772 public Builder putMetadata(java.lang.String key, java.lang.String value) { 1773 if (key == null) { 1774 throw new NullPointerException("map key"); 1775 } 1776 if (value == null) { 1777 throw new NullPointerException("map value"); 1778 } 1779 internalGetMutableMetadata().getMutableMap().put(key, value); 1780 bitField0_ |= 0x00000004; 1781 return this; 1782 } 1783 /** 1784 * 1785 * 1786 * <pre> 1787 * Metadata associated with the entity. 1788 * For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) 1789 * and Knowledge Graph MID (`mid`), if they are available. For the metadata 1790 * associated with other entity types, see the Type table below. 1791 * </pre> 1792 * 1793 * <code>map<string, string> metadata = 3;</code> 1794 */ putAllMetadata(java.util.Map<java.lang.String, java.lang.String> values)1795 public Builder putAllMetadata(java.util.Map<java.lang.String, java.lang.String> values) { 1796 internalGetMutableMetadata().getMutableMap().putAll(values); 1797 bitField0_ |= 0x00000004; 1798 return this; 1799 } 1800 1801 private float salience_; 1802 /** 1803 * 1804 * 1805 * <pre> 1806 * The salience score associated with the entity in the [0, 1.0] range. 1807 * The salience score for an entity provides information about the 1808 * importance or centrality of that entity to the entire document text. 1809 * Scores closer to 0 are less salient, while scores closer to 1.0 are highly 1810 * salient. 1811 * </pre> 1812 * 1813 * <code>float salience = 4;</code> 1814 * 1815 * @return The salience. 1816 */ 1817 @java.lang.Override getSalience()1818 public float getSalience() { 1819 return salience_; 1820 } 1821 /** 1822 * 1823 * 1824 * <pre> 1825 * The salience score associated with the entity in the [0, 1.0] range. 1826 * The salience score for an entity provides information about the 1827 * importance or centrality of that entity to the entire document text. 1828 * Scores closer to 0 are less salient, while scores closer to 1.0 are highly 1829 * salient. 1830 * </pre> 1831 * 1832 * <code>float salience = 4;</code> 1833 * 1834 * @param value The salience to set. 1835 * @return This builder for chaining. 1836 */ setSalience(float value)1837 public Builder setSalience(float value) { 1838 1839 salience_ = value; 1840 bitField0_ |= 0x00000008; 1841 onChanged(); 1842 return this; 1843 } 1844 /** 1845 * 1846 * 1847 * <pre> 1848 * The salience score associated with the entity in the [0, 1.0] range. 1849 * The salience score for an entity provides information about the 1850 * importance or centrality of that entity to the entire document text. 1851 * Scores closer to 0 are less salient, while scores closer to 1.0 are highly 1852 * salient. 1853 * </pre> 1854 * 1855 * <code>float salience = 4;</code> 1856 * 1857 * @return This builder for chaining. 1858 */ clearSalience()1859 public Builder clearSalience() { 1860 bitField0_ = (bitField0_ & ~0x00000008); 1861 salience_ = 0F; 1862 onChanged(); 1863 return this; 1864 } 1865 1866 private java.util.List<com.google.cloud.language.v1beta2.EntityMention> mentions_ = 1867 java.util.Collections.emptyList(); 1868 ensureMentionsIsMutable()1869 private void ensureMentionsIsMutable() { 1870 if (!((bitField0_ & 0x00000010) != 0)) { 1871 mentions_ = 1872 new java.util.ArrayList<com.google.cloud.language.v1beta2.EntityMention>(mentions_); 1873 bitField0_ |= 0x00000010; 1874 } 1875 } 1876 1877 private com.google.protobuf.RepeatedFieldBuilderV3< 1878 com.google.cloud.language.v1beta2.EntityMention, 1879 com.google.cloud.language.v1beta2.EntityMention.Builder, 1880 com.google.cloud.language.v1beta2.EntityMentionOrBuilder> 1881 mentionsBuilder_; 1882 1883 /** 1884 * 1885 * 1886 * <pre> 1887 * The mentions of this entity in the input document. The API currently 1888 * supports proper noun mentions. 1889 * </pre> 1890 * 1891 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 1892 */ getMentionsList()1893 public java.util.List<com.google.cloud.language.v1beta2.EntityMention> getMentionsList() { 1894 if (mentionsBuilder_ == null) { 1895 return java.util.Collections.unmodifiableList(mentions_); 1896 } else { 1897 return mentionsBuilder_.getMessageList(); 1898 } 1899 } 1900 /** 1901 * 1902 * 1903 * <pre> 1904 * The mentions of this entity in the input document. The API currently 1905 * supports proper noun mentions. 1906 * </pre> 1907 * 1908 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 1909 */ getMentionsCount()1910 public int getMentionsCount() { 1911 if (mentionsBuilder_ == null) { 1912 return mentions_.size(); 1913 } else { 1914 return mentionsBuilder_.getCount(); 1915 } 1916 } 1917 /** 1918 * 1919 * 1920 * <pre> 1921 * The mentions of this entity in the input document. The API currently 1922 * supports proper noun mentions. 1923 * </pre> 1924 * 1925 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 1926 */ getMentions(int index)1927 public com.google.cloud.language.v1beta2.EntityMention getMentions(int index) { 1928 if (mentionsBuilder_ == null) { 1929 return mentions_.get(index); 1930 } else { 1931 return mentionsBuilder_.getMessage(index); 1932 } 1933 } 1934 /** 1935 * 1936 * 1937 * <pre> 1938 * The mentions of this entity in the input document. The API currently 1939 * supports proper noun mentions. 1940 * </pre> 1941 * 1942 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 1943 */ setMentions(int index, com.google.cloud.language.v1beta2.EntityMention value)1944 public Builder setMentions(int index, com.google.cloud.language.v1beta2.EntityMention value) { 1945 if (mentionsBuilder_ == null) { 1946 if (value == null) { 1947 throw new NullPointerException(); 1948 } 1949 ensureMentionsIsMutable(); 1950 mentions_.set(index, value); 1951 onChanged(); 1952 } else { 1953 mentionsBuilder_.setMessage(index, value); 1954 } 1955 return this; 1956 } 1957 /** 1958 * 1959 * 1960 * <pre> 1961 * The mentions of this entity in the input document. The API currently 1962 * supports proper noun mentions. 1963 * </pre> 1964 * 1965 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 1966 */ setMentions( int index, com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue)1967 public Builder setMentions( 1968 int index, com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue) { 1969 if (mentionsBuilder_ == null) { 1970 ensureMentionsIsMutable(); 1971 mentions_.set(index, builderForValue.build()); 1972 onChanged(); 1973 } else { 1974 mentionsBuilder_.setMessage(index, builderForValue.build()); 1975 } 1976 return this; 1977 } 1978 /** 1979 * 1980 * 1981 * <pre> 1982 * The mentions of this entity in the input document. The API currently 1983 * supports proper noun mentions. 1984 * </pre> 1985 * 1986 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 1987 */ addMentions(com.google.cloud.language.v1beta2.EntityMention value)1988 public Builder addMentions(com.google.cloud.language.v1beta2.EntityMention value) { 1989 if (mentionsBuilder_ == null) { 1990 if (value == null) { 1991 throw new NullPointerException(); 1992 } 1993 ensureMentionsIsMutable(); 1994 mentions_.add(value); 1995 onChanged(); 1996 } else { 1997 mentionsBuilder_.addMessage(value); 1998 } 1999 return this; 2000 } 2001 /** 2002 * 2003 * 2004 * <pre> 2005 * The mentions of this entity in the input document. The API currently 2006 * supports proper noun mentions. 2007 * </pre> 2008 * 2009 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2010 */ addMentions(int index, com.google.cloud.language.v1beta2.EntityMention value)2011 public Builder addMentions(int index, com.google.cloud.language.v1beta2.EntityMention value) { 2012 if (mentionsBuilder_ == null) { 2013 if (value == null) { 2014 throw new NullPointerException(); 2015 } 2016 ensureMentionsIsMutable(); 2017 mentions_.add(index, value); 2018 onChanged(); 2019 } else { 2020 mentionsBuilder_.addMessage(index, value); 2021 } 2022 return this; 2023 } 2024 /** 2025 * 2026 * 2027 * <pre> 2028 * The mentions of this entity in the input document. The API currently 2029 * supports proper noun mentions. 2030 * </pre> 2031 * 2032 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2033 */ addMentions( com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue)2034 public Builder addMentions( 2035 com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue) { 2036 if (mentionsBuilder_ == null) { 2037 ensureMentionsIsMutable(); 2038 mentions_.add(builderForValue.build()); 2039 onChanged(); 2040 } else { 2041 mentionsBuilder_.addMessage(builderForValue.build()); 2042 } 2043 return this; 2044 } 2045 /** 2046 * 2047 * 2048 * <pre> 2049 * The mentions of this entity in the input document. The API currently 2050 * supports proper noun mentions. 2051 * </pre> 2052 * 2053 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2054 */ addMentions( int index, com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue)2055 public Builder addMentions( 2056 int index, com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue) { 2057 if (mentionsBuilder_ == null) { 2058 ensureMentionsIsMutable(); 2059 mentions_.add(index, builderForValue.build()); 2060 onChanged(); 2061 } else { 2062 mentionsBuilder_.addMessage(index, builderForValue.build()); 2063 } 2064 return this; 2065 } 2066 /** 2067 * 2068 * 2069 * <pre> 2070 * The mentions of this entity in the input document. The API currently 2071 * supports proper noun mentions. 2072 * </pre> 2073 * 2074 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2075 */ addAllMentions( java.lang.Iterable<? extends com.google.cloud.language.v1beta2.EntityMention> values)2076 public Builder addAllMentions( 2077 java.lang.Iterable<? extends com.google.cloud.language.v1beta2.EntityMention> values) { 2078 if (mentionsBuilder_ == null) { 2079 ensureMentionsIsMutable(); 2080 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, mentions_); 2081 onChanged(); 2082 } else { 2083 mentionsBuilder_.addAllMessages(values); 2084 } 2085 return this; 2086 } 2087 /** 2088 * 2089 * 2090 * <pre> 2091 * The mentions of this entity in the input document. The API currently 2092 * supports proper noun mentions. 2093 * </pre> 2094 * 2095 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2096 */ clearMentions()2097 public Builder clearMentions() { 2098 if (mentionsBuilder_ == null) { 2099 mentions_ = java.util.Collections.emptyList(); 2100 bitField0_ = (bitField0_ & ~0x00000010); 2101 onChanged(); 2102 } else { 2103 mentionsBuilder_.clear(); 2104 } 2105 return this; 2106 } 2107 /** 2108 * 2109 * 2110 * <pre> 2111 * The mentions of this entity in the input document. The API currently 2112 * supports proper noun mentions. 2113 * </pre> 2114 * 2115 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2116 */ removeMentions(int index)2117 public Builder removeMentions(int index) { 2118 if (mentionsBuilder_ == null) { 2119 ensureMentionsIsMutable(); 2120 mentions_.remove(index); 2121 onChanged(); 2122 } else { 2123 mentionsBuilder_.remove(index); 2124 } 2125 return this; 2126 } 2127 /** 2128 * 2129 * 2130 * <pre> 2131 * The mentions of this entity in the input document. The API currently 2132 * supports proper noun mentions. 2133 * </pre> 2134 * 2135 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2136 */ getMentionsBuilder(int index)2137 public com.google.cloud.language.v1beta2.EntityMention.Builder getMentionsBuilder(int index) { 2138 return getMentionsFieldBuilder().getBuilder(index); 2139 } 2140 /** 2141 * 2142 * 2143 * <pre> 2144 * The mentions of this entity in the input document. The API currently 2145 * supports proper noun mentions. 2146 * </pre> 2147 * 2148 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2149 */ getMentionsOrBuilder( int index)2150 public com.google.cloud.language.v1beta2.EntityMentionOrBuilder getMentionsOrBuilder( 2151 int index) { 2152 if (mentionsBuilder_ == null) { 2153 return mentions_.get(index); 2154 } else { 2155 return mentionsBuilder_.getMessageOrBuilder(index); 2156 } 2157 } 2158 /** 2159 * 2160 * 2161 * <pre> 2162 * The mentions of this entity in the input document. The API currently 2163 * supports proper noun mentions. 2164 * </pre> 2165 * 2166 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2167 */ 2168 public java.util.List<? extends com.google.cloud.language.v1beta2.EntityMentionOrBuilder> getMentionsOrBuilderList()2169 getMentionsOrBuilderList() { 2170 if (mentionsBuilder_ != null) { 2171 return mentionsBuilder_.getMessageOrBuilderList(); 2172 } else { 2173 return java.util.Collections.unmodifiableList(mentions_); 2174 } 2175 } 2176 /** 2177 * 2178 * 2179 * <pre> 2180 * The mentions of this entity in the input document. The API currently 2181 * supports proper noun mentions. 2182 * </pre> 2183 * 2184 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2185 */ addMentionsBuilder()2186 public com.google.cloud.language.v1beta2.EntityMention.Builder addMentionsBuilder() { 2187 return getMentionsFieldBuilder() 2188 .addBuilder(com.google.cloud.language.v1beta2.EntityMention.getDefaultInstance()); 2189 } 2190 /** 2191 * 2192 * 2193 * <pre> 2194 * The mentions of this entity in the input document. The API currently 2195 * supports proper noun mentions. 2196 * </pre> 2197 * 2198 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2199 */ addMentionsBuilder(int index)2200 public com.google.cloud.language.v1beta2.EntityMention.Builder addMentionsBuilder(int index) { 2201 return getMentionsFieldBuilder() 2202 .addBuilder(index, com.google.cloud.language.v1beta2.EntityMention.getDefaultInstance()); 2203 } 2204 /** 2205 * 2206 * 2207 * <pre> 2208 * The mentions of this entity in the input document. The API currently 2209 * supports proper noun mentions. 2210 * </pre> 2211 * 2212 * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> 2213 */ 2214 public java.util.List<com.google.cloud.language.v1beta2.EntityMention.Builder> getMentionsBuilderList()2215 getMentionsBuilderList() { 2216 return getMentionsFieldBuilder().getBuilderList(); 2217 } 2218 2219 private com.google.protobuf.RepeatedFieldBuilderV3< 2220 com.google.cloud.language.v1beta2.EntityMention, 2221 com.google.cloud.language.v1beta2.EntityMention.Builder, 2222 com.google.cloud.language.v1beta2.EntityMentionOrBuilder> getMentionsFieldBuilder()2223 getMentionsFieldBuilder() { 2224 if (mentionsBuilder_ == null) { 2225 mentionsBuilder_ = 2226 new com.google.protobuf.RepeatedFieldBuilderV3< 2227 com.google.cloud.language.v1beta2.EntityMention, 2228 com.google.cloud.language.v1beta2.EntityMention.Builder, 2229 com.google.cloud.language.v1beta2.EntityMentionOrBuilder>( 2230 mentions_, ((bitField0_ & 0x00000010) != 0), getParentForChildren(), isClean()); 2231 mentions_ = null; 2232 } 2233 return mentionsBuilder_; 2234 } 2235 2236 private com.google.cloud.language.v1beta2.Sentiment sentiment_; 2237 private com.google.protobuf.SingleFieldBuilderV3< 2238 com.google.cloud.language.v1beta2.Sentiment, 2239 com.google.cloud.language.v1beta2.Sentiment.Builder, 2240 com.google.cloud.language.v1beta2.SentimentOrBuilder> 2241 sentimentBuilder_; 2242 /** 2243 * 2244 * 2245 * <pre> 2246 * For calls to [AnalyzeEntitySentiment][] or if 2247 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2248 * true, this field will contain the aggregate sentiment expressed for this 2249 * entity in the provided document. 2250 * </pre> 2251 * 2252 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2253 * 2254 * @return Whether the sentiment field is set. 2255 */ hasSentiment()2256 public boolean hasSentiment() { 2257 return ((bitField0_ & 0x00000020) != 0); 2258 } 2259 /** 2260 * 2261 * 2262 * <pre> 2263 * For calls to [AnalyzeEntitySentiment][] or if 2264 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2265 * true, this field will contain the aggregate sentiment expressed for this 2266 * entity in the provided document. 2267 * </pre> 2268 * 2269 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2270 * 2271 * @return The sentiment. 2272 */ getSentiment()2273 public com.google.cloud.language.v1beta2.Sentiment getSentiment() { 2274 if (sentimentBuilder_ == null) { 2275 return sentiment_ == null 2276 ? com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance() 2277 : sentiment_; 2278 } else { 2279 return sentimentBuilder_.getMessage(); 2280 } 2281 } 2282 /** 2283 * 2284 * 2285 * <pre> 2286 * For calls to [AnalyzeEntitySentiment][] or if 2287 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2288 * true, this field will contain the aggregate sentiment expressed for this 2289 * entity in the provided document. 2290 * </pre> 2291 * 2292 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2293 */ setSentiment(com.google.cloud.language.v1beta2.Sentiment value)2294 public Builder setSentiment(com.google.cloud.language.v1beta2.Sentiment value) { 2295 if (sentimentBuilder_ == null) { 2296 if (value == null) { 2297 throw new NullPointerException(); 2298 } 2299 sentiment_ = value; 2300 } else { 2301 sentimentBuilder_.setMessage(value); 2302 } 2303 bitField0_ |= 0x00000020; 2304 onChanged(); 2305 return this; 2306 } 2307 /** 2308 * 2309 * 2310 * <pre> 2311 * For calls to [AnalyzeEntitySentiment][] or if 2312 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2313 * true, this field will contain the aggregate sentiment expressed for this 2314 * entity in the provided document. 2315 * </pre> 2316 * 2317 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2318 */ setSentiment( com.google.cloud.language.v1beta2.Sentiment.Builder builderForValue)2319 public Builder setSentiment( 2320 com.google.cloud.language.v1beta2.Sentiment.Builder builderForValue) { 2321 if (sentimentBuilder_ == null) { 2322 sentiment_ = builderForValue.build(); 2323 } else { 2324 sentimentBuilder_.setMessage(builderForValue.build()); 2325 } 2326 bitField0_ |= 0x00000020; 2327 onChanged(); 2328 return this; 2329 } 2330 /** 2331 * 2332 * 2333 * <pre> 2334 * For calls to [AnalyzeEntitySentiment][] or if 2335 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2336 * true, this field will contain the aggregate sentiment expressed for this 2337 * entity in the provided document. 2338 * </pre> 2339 * 2340 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2341 */ mergeSentiment(com.google.cloud.language.v1beta2.Sentiment value)2342 public Builder mergeSentiment(com.google.cloud.language.v1beta2.Sentiment value) { 2343 if (sentimentBuilder_ == null) { 2344 if (((bitField0_ & 0x00000020) != 0) 2345 && sentiment_ != null 2346 && sentiment_ != com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance()) { 2347 getSentimentBuilder().mergeFrom(value); 2348 } else { 2349 sentiment_ = value; 2350 } 2351 } else { 2352 sentimentBuilder_.mergeFrom(value); 2353 } 2354 bitField0_ |= 0x00000020; 2355 onChanged(); 2356 return this; 2357 } 2358 /** 2359 * 2360 * 2361 * <pre> 2362 * For calls to [AnalyzeEntitySentiment][] or if 2363 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2364 * true, this field will contain the aggregate sentiment expressed for this 2365 * entity in the provided document. 2366 * </pre> 2367 * 2368 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2369 */ clearSentiment()2370 public Builder clearSentiment() { 2371 bitField0_ = (bitField0_ & ~0x00000020); 2372 sentiment_ = null; 2373 if (sentimentBuilder_ != null) { 2374 sentimentBuilder_.dispose(); 2375 sentimentBuilder_ = null; 2376 } 2377 onChanged(); 2378 return this; 2379 } 2380 /** 2381 * 2382 * 2383 * <pre> 2384 * For calls to [AnalyzeEntitySentiment][] or if 2385 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2386 * true, this field will contain the aggregate sentiment expressed for this 2387 * entity in the provided document. 2388 * </pre> 2389 * 2390 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2391 */ getSentimentBuilder()2392 public com.google.cloud.language.v1beta2.Sentiment.Builder getSentimentBuilder() { 2393 bitField0_ |= 0x00000020; 2394 onChanged(); 2395 return getSentimentFieldBuilder().getBuilder(); 2396 } 2397 /** 2398 * 2399 * 2400 * <pre> 2401 * For calls to [AnalyzeEntitySentiment][] or if 2402 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2403 * true, this field will contain the aggregate sentiment expressed for this 2404 * entity in the provided document. 2405 * </pre> 2406 * 2407 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2408 */ getSentimentOrBuilder()2409 public com.google.cloud.language.v1beta2.SentimentOrBuilder getSentimentOrBuilder() { 2410 if (sentimentBuilder_ != null) { 2411 return sentimentBuilder_.getMessageOrBuilder(); 2412 } else { 2413 return sentiment_ == null 2414 ? com.google.cloud.language.v1beta2.Sentiment.getDefaultInstance() 2415 : sentiment_; 2416 } 2417 } 2418 /** 2419 * 2420 * 2421 * <pre> 2422 * For calls to [AnalyzeEntitySentiment][] or if 2423 * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to 2424 * true, this field will contain the aggregate sentiment expressed for this 2425 * entity in the provided document. 2426 * </pre> 2427 * 2428 * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> 2429 */ 2430 private com.google.protobuf.SingleFieldBuilderV3< 2431 com.google.cloud.language.v1beta2.Sentiment, 2432 com.google.cloud.language.v1beta2.Sentiment.Builder, 2433 com.google.cloud.language.v1beta2.SentimentOrBuilder> getSentimentFieldBuilder()2434 getSentimentFieldBuilder() { 2435 if (sentimentBuilder_ == null) { 2436 sentimentBuilder_ = 2437 new com.google.protobuf.SingleFieldBuilderV3< 2438 com.google.cloud.language.v1beta2.Sentiment, 2439 com.google.cloud.language.v1beta2.Sentiment.Builder, 2440 com.google.cloud.language.v1beta2.SentimentOrBuilder>( 2441 getSentiment(), getParentForChildren(), isClean()); 2442 sentiment_ = null; 2443 } 2444 return sentimentBuilder_; 2445 } 2446 2447 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)2448 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 2449 return super.setUnknownFields(unknownFields); 2450 } 2451 2452 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2453 public final Builder mergeUnknownFields( 2454 final com.google.protobuf.UnknownFieldSet unknownFields) { 2455 return super.mergeUnknownFields(unknownFields); 2456 } 2457 2458 // @@protoc_insertion_point(builder_scope:google.cloud.language.v1beta2.Entity) 2459 } 2460 2461 // @@protoc_insertion_point(class_scope:google.cloud.language.v1beta2.Entity) 2462 private static final com.google.cloud.language.v1beta2.Entity DEFAULT_INSTANCE; 2463 2464 static { 2465 DEFAULT_INSTANCE = new com.google.cloud.language.v1beta2.Entity(); 2466 } 2467 getDefaultInstance()2468 public static com.google.cloud.language.v1beta2.Entity getDefaultInstance() { 2469 return DEFAULT_INSTANCE; 2470 } 2471 2472 private static final com.google.protobuf.Parser<Entity> PARSER = 2473 new com.google.protobuf.AbstractParser<Entity>() { 2474 @java.lang.Override 2475 public Entity parsePartialFrom( 2476 com.google.protobuf.CodedInputStream input, 2477 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2478 throws com.google.protobuf.InvalidProtocolBufferException { 2479 Builder builder = newBuilder(); 2480 try { 2481 builder.mergeFrom(input, extensionRegistry); 2482 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2483 throw e.setUnfinishedMessage(builder.buildPartial()); 2484 } catch (com.google.protobuf.UninitializedMessageException e) { 2485 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 2486 } catch (java.io.IOException e) { 2487 throw new com.google.protobuf.InvalidProtocolBufferException(e) 2488 .setUnfinishedMessage(builder.buildPartial()); 2489 } 2490 return builder.buildPartial(); 2491 } 2492 }; 2493 parser()2494 public static com.google.protobuf.Parser<Entity> parser() { 2495 return PARSER; 2496 } 2497 2498 @java.lang.Override getParserForType()2499 public com.google.protobuf.Parser<Entity> getParserForType() { 2500 return PARSER; 2501 } 2502 2503 @java.lang.Override getDefaultInstanceForType()2504 public com.google.cloud.language.v1beta2.Entity getDefaultInstanceForType() { 2505 return DEFAULT_INSTANCE; 2506 } 2507 } 2508