All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.language.v1.Entity Maven / Gradle / Ivy

There is a newer version: 2.50.0
Show newest version
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/language/v1/language_service.proto

package com.google.cloud.language.v1;

/**
 * 
 * Represents a phrase in the text that is a known entity, such as
 * a person, an organization, or location. The API associates information, such
 * as salience and mentions, with entities.
 * 
* * Protobuf type {@code google.cloud.language.v1.Entity} */ public final class Entity extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.cloud.language.v1.Entity) EntityOrBuilder { // Use Entity.newBuilder() to construct. private Entity(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } private Entity() { name_ = ""; type_ = 0; salience_ = 0F; mentions_ = java.util.Collections.emptyList(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private Entity( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); int mutable_bitField0_ = 0; try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!input.skipField(tag)) { done = true; } break; } case 10: { java.lang.String s = input.readStringRequireUtf8(); name_ = s; break; } case 16: { int rawValue = input.readEnum(); type_ = rawValue; break; } case 26: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { metadata_ = com.google.protobuf.MapField.newMapField( MetadataDefaultEntryHolder.defaultEntry); mutable_bitField0_ |= 0x00000004; } com.google.protobuf.MapEntry metadata__ = input.readMessage( MetadataDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); metadata_.getMutableMap().put( metadata__.getKey(), metadata__.getValue()); break; } case 37: { salience_ = input.readFloat(); break; } case 42: { if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { mentions_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000010; } mentions_.add( input.readMessage(com.google.cloud.language.v1.EntityMention.parser(), extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { mentions_ = java.util.Collections.unmodifiableList(mentions_); } makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_Entity_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 3: return internalGetMetadata(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_Entity_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.language.v1.Entity.class, com.google.cloud.language.v1.Entity.Builder.class); } /** *
   * The type of the entity.
   * 
* * Protobuf enum {@code google.cloud.language.v1.Entity.Type} */ public enum Type implements com.google.protobuf.ProtocolMessageEnum { /** *
     * Unknown
     * 
* * UNKNOWN = 0; */ UNKNOWN(0), /** *
     * Person
     * 
* * PERSON = 1; */ PERSON(1), /** *
     * Location
     * 
* * LOCATION = 2; */ LOCATION(2), /** *
     * Organization
     * 
* * ORGANIZATION = 3; */ ORGANIZATION(3), /** *
     * Event
     * 
* * EVENT = 4; */ EVENT(4), /** *
     * Work of art
     * 
* * WORK_OF_ART = 5; */ WORK_OF_ART(5), /** *
     * Consumer goods
     * 
* * CONSUMER_GOOD = 6; */ CONSUMER_GOOD(6), /** *
     * Other types
     * 
* * OTHER = 7; */ OTHER(7), UNRECOGNIZED(-1), ; /** *
     * Unknown
     * 
* * UNKNOWN = 0; */ public static final int UNKNOWN_VALUE = 0; /** *
     * Person
     * 
* * PERSON = 1; */ public static final int PERSON_VALUE = 1; /** *
     * Location
     * 
* * LOCATION = 2; */ public static final int LOCATION_VALUE = 2; /** *
     * Organization
     * 
* * ORGANIZATION = 3; */ public static final int ORGANIZATION_VALUE = 3; /** *
     * Event
     * 
* * EVENT = 4; */ public static final int EVENT_VALUE = 4; /** *
     * Work of art
     * 
* * WORK_OF_ART = 5; */ public static final int WORK_OF_ART_VALUE = 5; /** *
     * Consumer goods
     * 
* * CONSUMER_GOOD = 6; */ public static final int CONSUMER_GOOD_VALUE = 6; /** *
     * Other types
     * 
* * OTHER = 7; */ public static final int OTHER_VALUE = 7; public final int getNumber() { if (this == UNRECOGNIZED) { throw new java.lang.IllegalArgumentException( "Can't get the number of an unknown enum value."); } return value; } /** * @deprecated Use {@link #forNumber(int)} instead. */ @java.lang.Deprecated public static Type valueOf(int value) { return forNumber(value); } public static Type forNumber(int value) { switch (value) { case 0: return UNKNOWN; case 1: return PERSON; case 2: return LOCATION; case 3: return ORGANIZATION; case 4: return EVENT; case 5: return WORK_OF_ART; case 6: return CONSUMER_GOOD; case 7: return OTHER; default: return null; } } public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { return internalValueMap; } private static final com.google.protobuf.Internal.EnumLiteMap< Type> internalValueMap = new com.google.protobuf.Internal.EnumLiteMap() { public Type findValueByNumber(int number) { return Type.forNumber(number); } }; public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { return getDescriptor().getValues().get(ordinal()); } public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { return getDescriptor(); } public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { return com.google.cloud.language.v1.Entity.getDescriptor().getEnumTypes().get(0); } private static final Type[] VALUES = values(); public static Type valueOf( com.google.protobuf.Descriptors.EnumValueDescriptor desc) { if (desc.getType() != getDescriptor()) { throw new java.lang.IllegalArgumentException( "EnumValueDescriptor is not for this type."); } if (desc.getIndex() == -1) { return UNRECOGNIZED; } return VALUES[desc.getIndex()]; } private final int value; private Type(int value) { this.value = value; } // @@protoc_insertion_point(enum_scope:google.cloud.language.v1.Entity.Type) } private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; private volatile java.lang.Object name_; /** *
   * The representative name for the entity.
   * 
* * string name = 1; */ public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); name_ = s; return s; } } /** *
   * The representative name for the entity.
   * 
* * string name = 1; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int TYPE_FIELD_NUMBER = 2; private int type_; /** *
   * The entity type.
   * 
* * .google.cloud.language.v1.Entity.Type type = 2; */ public int getTypeValue() { return type_; } /** *
   * The entity type.
   * 
* * .google.cloud.language.v1.Entity.Type type = 2; */ public com.google.cloud.language.v1.Entity.Type getType() { com.google.cloud.language.v1.Entity.Type result = com.google.cloud.language.v1.Entity.Type.valueOf(type_); return result == null ? com.google.cloud.language.v1.Entity.Type.UNRECOGNIZED : result; } public static final int METADATA_FIELD_NUMBER = 3; private static final class MetadataDefaultEntryHolder { static final com.google.protobuf.MapEntry< java.lang.String, java.lang.String> defaultEntry = com.google.protobuf.MapEntry .newDefaultInstance( com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_Entity_MetadataEntry_descriptor, com.google.protobuf.WireFormat.FieldType.STRING, "", com.google.protobuf.WireFormat.FieldType.STRING, ""); } private com.google.protobuf.MapField< java.lang.String, java.lang.String> metadata_; private com.google.protobuf.MapField internalGetMetadata() { if (metadata_ == null) { return com.google.protobuf.MapField.emptyMapField( MetadataDefaultEntryHolder.defaultEntry); } return metadata_; } public int getMetadataCount() { return internalGetMetadata().getMap().size(); } /** *
   * Metadata associated with the entity.
   * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
   * available. The associated keys are "wikipedia_url" and "mid", respectively.
   * 
* * map<string, string> metadata = 3; */ public boolean containsMetadata( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetMetadata().getMap().containsKey(key); } /** * Use {@link #getMetadataMap()} instead. */ @java.lang.Deprecated public java.util.Map getMetadata() { return getMetadataMap(); } /** *
   * Metadata associated with the entity.
   * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
   * available. The associated keys are "wikipedia_url" and "mid", respectively.
   * 
* * map<string, string> metadata = 3; */ public java.util.Map getMetadataMap() { return internalGetMetadata().getMap(); } /** *
   * Metadata associated with the entity.
   * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
   * available. The associated keys are "wikipedia_url" and "mid", respectively.
   * 
* * map<string, string> metadata = 3; */ public java.lang.String getMetadataOrDefault( java.lang.String key, java.lang.String defaultValue) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map map = internalGetMetadata().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /** *
   * Metadata associated with the entity.
   * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
   * available. The associated keys are "wikipedia_url" and "mid", respectively.
   * 
* * map<string, string> metadata = 3; */ public java.lang.String getMetadataOrThrow( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map map = internalGetMetadata().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); } public static final int SALIENCE_FIELD_NUMBER = 4; private float salience_; /** *
   * The salience score associated with the entity in the [0, 1.0] range.
   * The salience score for an entity provides information about the
   * importance or centrality of that entity to the entire document text.
   * Scores closer to 0 are less salient, while scores closer to 1.0 are highly
   * salient.
   * 
* * float salience = 4; */ public float getSalience() { return salience_; } public static final int MENTIONS_FIELD_NUMBER = 5; private java.util.List mentions_; /** *
   * The mentions of this entity in the input document. The API currently
   * supports proper noun mentions.
   * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public java.util.List getMentionsList() { return mentions_; } /** *
   * The mentions of this entity in the input document. The API currently
   * supports proper noun mentions.
   * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public java.util.List getMentionsOrBuilderList() { return mentions_; } /** *
   * The mentions of this entity in the input document. The API currently
   * supports proper noun mentions.
   * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public int getMentionsCount() { return mentions_.size(); } /** *
   * The mentions of this entity in the input document. The API currently
   * supports proper noun mentions.
   * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public com.google.cloud.language.v1.EntityMention getMentions(int index) { return mentions_.get(index); } /** *
   * The mentions of this entity in the input document. The API currently
   * supports proper noun mentions.
   * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public com.google.cloud.language.v1.EntityMentionOrBuilder getMentionsOrBuilder( int index) { return mentions_.get(index); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (!getNameBytes().isEmpty()) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (type_ != com.google.cloud.language.v1.Entity.Type.UNKNOWN.getNumber()) { output.writeEnum(2, type_); } com.google.protobuf.GeneratedMessageV3 .serializeStringMapTo( output, internalGetMetadata(), MetadataDefaultEntryHolder.defaultEntry, 3); if (salience_ != 0F) { output.writeFloat(4, salience_); } for (int i = 0; i < mentions_.size(); i++) { output.writeMessage(5, mentions_.get(i)); } } public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } if (type_ != com.google.cloud.language.v1.Entity.Type.UNKNOWN.getNumber()) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(2, type_); } for (java.util.Map.Entry entry : internalGetMetadata().getMap().entrySet()) { com.google.protobuf.MapEntry metadata__ = MetadataDefaultEntryHolder.defaultEntry.newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, metadata__); } if (salience_ != 0F) { size += com.google.protobuf.CodedOutputStream .computeFloatSize(4, salience_); } for (int i = 0; i < mentions_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, mentions_.get(i)); } memoizedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1.Entity)) { return super.equals(obj); } com.google.cloud.language.v1.Entity other = (com.google.cloud.language.v1.Entity) obj; boolean result = true; result = result && getName() .equals(other.getName()); result = result && type_ == other.type_; result = result && internalGetMetadata().equals( other.internalGetMetadata()); result = result && ( java.lang.Float.floatToIntBits(getSalience()) == java.lang.Float.floatToIntBits( other.getSalience())); result = result && getMentionsList() .equals(other.getMentionsList()); return result; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (37 * hash) + TYPE_FIELD_NUMBER; hash = (53 * hash) + type_; if (!internalGetMetadata().getMap().isEmpty()) { hash = (37 * hash) + METADATA_FIELD_NUMBER; hash = (53 * hash) + internalGetMetadata().hashCode(); } hash = (37 * hash) + SALIENCE_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits( getSalience()); if (getMentionsCount() > 0) { hash = (37 * hash) + MENTIONS_FIELD_NUMBER; hash = (53 * hash) + getMentionsList().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static com.google.cloud.language.v1.Entity parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.language.v1.Entity parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.language.v1.Entity parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.cloud.language.v1.Entity parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.cloud.language.v1.Entity parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.language.v1.Entity parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.language.v1.Entity parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.cloud.language.v1.Entity parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.cloud.language.v1.Entity parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.cloud.language.v1.Entity parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.cloud.language.v1.Entity prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** *
   * Represents a phrase in the text that is a known entity, such as
   * a person, an organization, or location. The API associates information, such
   * as salience and mentions, with entities.
   * 
* * Protobuf type {@code google.cloud.language.v1.Entity} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:google.cloud.language.v1.Entity) com.google.cloud.language.v1.EntityOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_Entity_descriptor; } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMapField( int number) { switch (number) { case 3: return internalGetMetadata(); default: throw new RuntimeException( "Invalid map field number: " + number); } } @SuppressWarnings({"rawtypes"}) protected com.google.protobuf.MapField internalGetMutableMapField( int number) { switch (number) { case 3: return internalGetMutableMetadata(); default: throw new RuntimeException( "Invalid map field number: " + number); } } protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_Entity_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.cloud.language.v1.Entity.class, com.google.cloud.language.v1.Entity.Builder.class); } // Construct using com.google.cloud.language.v1.Entity.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { getMentionsFieldBuilder(); } } public Builder clear() { super.clear(); name_ = ""; type_ = 0; internalGetMutableMetadata().clear(); salience_ = 0F; if (mentionsBuilder_ == null) { mentions_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000010); } else { mentionsBuilder_.clear(); } return this; } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.cloud.language.v1.LanguageServiceProto.internal_static_google_cloud_language_v1_Entity_descriptor; } public com.google.cloud.language.v1.Entity getDefaultInstanceForType() { return com.google.cloud.language.v1.Entity.getDefaultInstance(); } public com.google.cloud.language.v1.Entity build() { com.google.cloud.language.v1.Entity result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public com.google.cloud.language.v1.Entity buildPartial() { com.google.cloud.language.v1.Entity result = new com.google.cloud.language.v1.Entity(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.name_ = name_; result.type_ = type_; result.metadata_ = internalGetMetadata(); result.metadata_.makeImmutable(); result.salience_ = salience_; if (mentionsBuilder_ == null) { if (((bitField0_ & 0x00000010) == 0x00000010)) { mentions_ = java.util.Collections.unmodifiableList(mentions_); bitField0_ = (bitField0_ & ~0x00000010); } result.mentions_ = mentions_; } else { result.mentions_ = mentionsBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder clone() { return (Builder) super.clone(); } public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return (Builder) super.setField(field, value); } public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return (Builder) super.clearField(field); } public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return (Builder) super.clearOneof(oneof); } public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { return (Builder) super.setRepeatedField(field, index, value); } public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { return (Builder) super.addRepeatedField(field, value); } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.cloud.language.v1.Entity) { return mergeFrom((com.google.cloud.language.v1.Entity)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.cloud.language.v1.Entity other) { if (other == com.google.cloud.language.v1.Entity.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (other.type_ != 0) { setTypeValue(other.getTypeValue()); } internalGetMutableMetadata().mergeFrom( other.internalGetMetadata()); if (other.getSalience() != 0F) { setSalience(other.getSalience()); } if (mentionsBuilder_ == null) { if (!other.mentions_.isEmpty()) { if (mentions_.isEmpty()) { mentions_ = other.mentions_; bitField0_ = (bitField0_ & ~0x00000010); } else { ensureMentionsIsMutable(); mentions_.addAll(other.mentions_); } onChanged(); } } else { if (!other.mentions_.isEmpty()) { if (mentionsBuilder_.isEmpty()) { mentionsBuilder_.dispose(); mentionsBuilder_ = null; mentions_ = other.mentions_; bitField0_ = (bitField0_ & ~0x00000010); mentionsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getMentionsFieldBuilder() : null; } else { mentionsBuilder_.addAllMessages(other.mentions_); } } } onChanged(); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { com.google.cloud.language.v1.Entity parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (com.google.cloud.language.v1.Entity) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; private java.lang.Object name_ = ""; /** *
     * The representative name for the entity.
     * 
* * string name = 1; */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); name_ = s; return s; } else { return (java.lang.String) ref; } } /** *
     * The representative name for the entity.
     * 
* * string name = 1; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** *
     * The representative name for the entity.
     * 
* * string name = 1; */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } name_ = value; onChanged(); return this; } /** *
     * The representative name for the entity.
     * 
* * string name = 1; */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /** *
     * The representative name for the entity.
     * 
* * string name = 1; */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); name_ = value; onChanged(); return this; } private int type_ = 0; /** *
     * The entity type.
     * 
* * .google.cloud.language.v1.Entity.Type type = 2; */ public int getTypeValue() { return type_; } /** *
     * The entity type.
     * 
* * .google.cloud.language.v1.Entity.Type type = 2; */ public Builder setTypeValue(int value) { type_ = value; onChanged(); return this; } /** *
     * The entity type.
     * 
* * .google.cloud.language.v1.Entity.Type type = 2; */ public com.google.cloud.language.v1.Entity.Type getType() { com.google.cloud.language.v1.Entity.Type result = com.google.cloud.language.v1.Entity.Type.valueOf(type_); return result == null ? com.google.cloud.language.v1.Entity.Type.UNRECOGNIZED : result; } /** *
     * The entity type.
     * 
* * .google.cloud.language.v1.Entity.Type type = 2; */ public Builder setType(com.google.cloud.language.v1.Entity.Type value) { if (value == null) { throw new NullPointerException(); } type_ = value.getNumber(); onChanged(); return this; } /** *
     * The entity type.
     * 
* * .google.cloud.language.v1.Entity.Type type = 2; */ public Builder clearType() { type_ = 0; onChanged(); return this; } private com.google.protobuf.MapField< java.lang.String, java.lang.String> metadata_; private com.google.protobuf.MapField internalGetMetadata() { if (metadata_ == null) { return com.google.protobuf.MapField.emptyMapField( MetadataDefaultEntryHolder.defaultEntry); } return metadata_; } private com.google.protobuf.MapField internalGetMutableMetadata() { onChanged();; if (metadata_ == null) { metadata_ = com.google.protobuf.MapField.newMapField( MetadataDefaultEntryHolder.defaultEntry); } if (!metadata_.isMutable()) { metadata_ = metadata_.copy(); } return metadata_; } public int getMetadataCount() { return internalGetMetadata().getMap().size(); } /** *
     * Metadata associated with the entity.
     * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
     * available. The associated keys are "wikipedia_url" and "mid", respectively.
     * 
* * map<string, string> metadata = 3; */ public boolean containsMetadata( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetMetadata().getMap().containsKey(key); } /** * Use {@link #getMetadataMap()} instead. */ @java.lang.Deprecated public java.util.Map getMetadata() { return getMetadataMap(); } /** *
     * Metadata associated with the entity.
     * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
     * available. The associated keys are "wikipedia_url" and "mid", respectively.
     * 
* * map<string, string> metadata = 3; */ public java.util.Map getMetadataMap() { return internalGetMetadata().getMap(); } /** *
     * Metadata associated with the entity.
     * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
     * available. The associated keys are "wikipedia_url" and "mid", respectively.
     * 
* * map<string, string> metadata = 3; */ public java.lang.String getMetadataOrDefault( java.lang.String key, java.lang.String defaultValue) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map map = internalGetMetadata().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /** *
     * Metadata associated with the entity.
     * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
     * available. The associated keys are "wikipedia_url" and "mid", respectively.
     * 
* * map<string, string> metadata = 3; */ public java.lang.String getMetadataOrThrow( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map map = internalGetMetadata().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); } public Builder clearMetadata() { internalGetMutableMetadata().getMutableMap() .clear(); return this; } /** *
     * Metadata associated with the entity.
     * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
     * available. The associated keys are "wikipedia_url" and "mid", respectively.
     * 
* * map<string, string> metadata = 3; */ public Builder removeMetadata( java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } internalGetMutableMetadata().getMutableMap() .remove(key); return this; } /** * Use alternate mutation accessors instead. */ @java.lang.Deprecated public java.util.Map getMutableMetadata() { return internalGetMutableMetadata().getMutableMap(); } /** *
     * Metadata associated with the entity.
     * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
     * available. The associated keys are "wikipedia_url" and "mid", respectively.
     * 
* * map<string, string> metadata = 3; */ public Builder putMetadata( java.lang.String key, java.lang.String value) { if (key == null) { throw new java.lang.NullPointerException(); } if (value == null) { throw new java.lang.NullPointerException(); } internalGetMutableMetadata().getMutableMap() .put(key, value); return this; } /** *
     * Metadata associated with the entity.
     * Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
     * available. The associated keys are "wikipedia_url" and "mid", respectively.
     * 
* * map<string, string> metadata = 3; */ public Builder putAllMetadata( java.util.Map values) { internalGetMutableMetadata().getMutableMap() .putAll(values); return this; } private float salience_ ; /** *
     * The salience score associated with the entity in the [0, 1.0] range.
     * The salience score for an entity provides information about the
     * importance or centrality of that entity to the entire document text.
     * Scores closer to 0 are less salient, while scores closer to 1.0 are highly
     * salient.
     * 
* * float salience = 4; */ public float getSalience() { return salience_; } /** *
     * The salience score associated with the entity in the [0, 1.0] range.
     * The salience score for an entity provides information about the
     * importance or centrality of that entity to the entire document text.
     * Scores closer to 0 are less salient, while scores closer to 1.0 are highly
     * salient.
     * 
* * float salience = 4; */ public Builder setSalience(float value) { salience_ = value; onChanged(); return this; } /** *
     * The salience score associated with the entity in the [0, 1.0] range.
     * The salience score for an entity provides information about the
     * importance or centrality of that entity to the entire document text.
     * Scores closer to 0 are less salient, while scores closer to 1.0 are highly
     * salient.
     * 
* * float salience = 4; */ public Builder clearSalience() { salience_ = 0F; onChanged(); return this; } private java.util.List mentions_ = java.util.Collections.emptyList(); private void ensureMentionsIsMutable() { if (!((bitField0_ & 0x00000010) == 0x00000010)) { mentions_ = new java.util.ArrayList(mentions_); bitField0_ |= 0x00000010; } } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.language.v1.EntityMention, com.google.cloud.language.v1.EntityMention.Builder, com.google.cloud.language.v1.EntityMentionOrBuilder> mentionsBuilder_; /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public java.util.List getMentionsList() { if (mentionsBuilder_ == null) { return java.util.Collections.unmodifiableList(mentions_); } else { return mentionsBuilder_.getMessageList(); } } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public int getMentionsCount() { if (mentionsBuilder_ == null) { return mentions_.size(); } else { return mentionsBuilder_.getCount(); } } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public com.google.cloud.language.v1.EntityMention getMentions(int index) { if (mentionsBuilder_ == null) { return mentions_.get(index); } else { return mentionsBuilder_.getMessage(index); } } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder setMentions( int index, com.google.cloud.language.v1.EntityMention value) { if (mentionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMentionsIsMutable(); mentions_.set(index, value); onChanged(); } else { mentionsBuilder_.setMessage(index, value); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder setMentions( int index, com.google.cloud.language.v1.EntityMention.Builder builderForValue) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); mentions_.set(index, builderForValue.build()); onChanged(); } else { mentionsBuilder_.setMessage(index, builderForValue.build()); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder addMentions(com.google.cloud.language.v1.EntityMention value) { if (mentionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMentionsIsMutable(); mentions_.add(value); onChanged(); } else { mentionsBuilder_.addMessage(value); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder addMentions( int index, com.google.cloud.language.v1.EntityMention value) { if (mentionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMentionsIsMutable(); mentions_.add(index, value); onChanged(); } else { mentionsBuilder_.addMessage(index, value); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder addMentions( com.google.cloud.language.v1.EntityMention.Builder builderForValue) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); mentions_.add(builderForValue.build()); onChanged(); } else { mentionsBuilder_.addMessage(builderForValue.build()); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder addMentions( int index, com.google.cloud.language.v1.EntityMention.Builder builderForValue) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); mentions_.add(index, builderForValue.build()); onChanged(); } else { mentionsBuilder_.addMessage(index, builderForValue.build()); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder addAllMentions( java.lang.Iterable values) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll( values, mentions_); onChanged(); } else { mentionsBuilder_.addAllMessages(values); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder clearMentions() { if (mentionsBuilder_ == null) { mentions_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000010); onChanged(); } else { mentionsBuilder_.clear(); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public Builder removeMentions(int index) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); mentions_.remove(index); onChanged(); } else { mentionsBuilder_.remove(index); } return this; } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public com.google.cloud.language.v1.EntityMention.Builder getMentionsBuilder( int index) { return getMentionsFieldBuilder().getBuilder(index); } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public com.google.cloud.language.v1.EntityMentionOrBuilder getMentionsOrBuilder( int index) { if (mentionsBuilder_ == null) { return mentions_.get(index); } else { return mentionsBuilder_.getMessageOrBuilder(index); } } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public java.util.List getMentionsOrBuilderList() { if (mentionsBuilder_ != null) { return mentionsBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(mentions_); } } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public com.google.cloud.language.v1.EntityMention.Builder addMentionsBuilder() { return getMentionsFieldBuilder().addBuilder( com.google.cloud.language.v1.EntityMention.getDefaultInstance()); } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public com.google.cloud.language.v1.EntityMention.Builder addMentionsBuilder( int index) { return getMentionsFieldBuilder().addBuilder( index, com.google.cloud.language.v1.EntityMention.getDefaultInstance()); } /** *
     * The mentions of this entity in the input document. The API currently
     * supports proper noun mentions.
     * 
* * repeated .google.cloud.language.v1.EntityMention mentions = 5; */ public java.util.List getMentionsBuilderList() { return getMentionsFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.language.v1.EntityMention, com.google.cloud.language.v1.EntityMention.Builder, com.google.cloud.language.v1.EntityMentionOrBuilder> getMentionsFieldBuilder() { if (mentionsBuilder_ == null) { mentionsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< com.google.cloud.language.v1.EntityMention, com.google.cloud.language.v1.EntityMention.Builder, com.google.cloud.language.v1.EntityMentionOrBuilder>( mentions_, ((bitField0_ & 0x00000010) == 0x00000010), getParentForChildren(), isClean()); mentions_ = null; } return mentionsBuilder_; } public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return this; } // @@protoc_insertion_point(builder_scope:google.cloud.language.v1.Entity) } // @@protoc_insertion_point(class_scope:google.cloud.language.v1.Entity) private static final com.google.cloud.language.v1.Entity DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.cloud.language.v1.Entity(); } public static com.google.cloud.language.v1.Entity getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public Entity parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Entity(input, extensionRegistry); } }; public static com.google.protobuf.Parser parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } public com.google.cloud.language.v1.Entity getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy