/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public Builder addMentions(int index, com.google.cloud.language.v1beta2.EntityMention value) { if (mentionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMentionsIsMutable(); mentions_.add(index, value); onChanged(); } else { mentionsBuilder_.addMessage(index, value); } return this; } /**
/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public com.google.cloud.language.v1beta2.EntityMention.Builder addMentionsBuilder(int index) { return getMentionsFieldBuilder() .addBuilder(index, com.google.cloud.language.v1beta2.EntityMention.getDefaultInstance()); } /**
/** Use {@link #getMetadataMap()} instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, java.lang.String> getMetadata() { return getMetadataMap(); } /**
if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); setTypeValue(other.getTypeValue()); internalGetMutableMetadata().mergeFrom(other.internalGetMetadata()); if (other.getSalience() != 0F) { setSalience(other.getSalience()); bitField0_ = (bitField0_ & ~0x00000010); } else { ensureMentionsIsMutable(); mentions_.addAll(other.mentions_); onChanged(); mentionsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getMentionsFieldBuilder() : null; } else { mergeSentiment(other.getSentiment()); this.mergeUnknownFields(other.unknownFields); onChanged(); return this;
@java.lang.Override public com.google.cloud.language.v1beta2.Entity buildPartial() { com.google.cloud.language.v1beta2.Entity result = new com.google.cloud.language.v1beta2.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(); } if (sentimentBuilder_ == null) { result.sentiment_ = sentiment_; } else { result.sentiment_ = sentimentBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
/** * * * <pre> * For calls to [AnalyzeEntitySentiment][] or if * [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment] is set to * true, this field will contain the aggregate sentiment expressed for this * entity in the provided document. * </pre> * * <code>.google.cloud.language.v1beta2.Sentiment sentiment = 6;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.language.v1beta2.Sentiment, com.google.cloud.language.v1beta2.Sentiment.Builder, com.google.cloud.language.v1beta2.SentimentOrBuilder> getSentimentFieldBuilder() { if (sentimentBuilder_ == null) { sentimentBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.cloud.language.v1beta2.Sentiment, com.google.cloud.language.v1beta2.Sentiment.Builder, com.google.cloud.language.v1beta2.SentimentOrBuilder>( getSentiment(), getParentForChildren(), isClean()); sentiment_ = null; } return sentimentBuilder_; }
/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public Builder addMentions(com.google.cloud.language.v1beta2.EntityMention value) { if (mentionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMentionsIsMutable(); mentions_.add(value); onChanged(); } else { mentionsBuilder_.addMessage(value); } return this; } /**
/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public Builder setMentions(int index, com.google.cloud.language.v1beta2.EntityMention value) { if (mentionsBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMentionsIsMutable(); mentions_.set(index, value); onChanged(); } else { mentionsBuilder_.setMessage(index, value); } return this; } /**
/** * * * <pre> * Entities, along with their semantic information, in the input document. * Populated if the user enables * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. * </pre> * * <code>repeated .google.cloud.language.v1beta2.Entity entities = 3;</code> */ public Builder setEntities( int index, com.google.cloud.language.v1beta2.Entity.Builder builderForValue) { if (entitiesBuilder_ == null) { ensureEntitiesIsMutable(); entities_.set(index, builderForValue.build()); onChanged(); } else { entitiesBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public Builder addAllMentions( java.lang.Iterable<? extends com.google.cloud.language.v1beta2.EntityMention> values) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, mentions_); onChanged(); } else { mentionsBuilder_.addAllMessages(values); } return this; } /**
/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public Builder setMentions( int index, com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); mentions_.set(index, builderForValue.build()); onChanged(); } else { mentionsBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * Entities, along with their semantic information, in the input document. * Populated if the user enables * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. * </pre> * * <code>repeated .google.cloud.language.v1beta2.Entity entities = 3;</code> */ public Builder addEntities( int index, com.google.cloud.language.v1beta2.Entity.Builder builderForValue) { if (entitiesBuilder_ == null) { ensureEntitiesIsMutable(); entities_.add(index, builderForValue.build()); onChanged(); } else { entitiesBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * Entities, along with their semantic information, in the input document. * Populated if the user enables * [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities]. * </pre> * * <code>repeated .google.cloud.language.v1beta2.Entity entities = 3;</code> */ public Builder addEntities(com.google.cloud.language.v1beta2.Entity.Builder builderForValue) { if (entitiesBuilder_ == null) { ensureEntitiesIsMutable(); entities_.add(builderForValue.build()); onChanged(); } else { entitiesBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public Builder addMentions( com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); mentions_.add(builderForValue.build()); onChanged(); } else { mentionsBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * * * <pre> * The recognized entities in the input document with associated sentiments. * </pre> * * <code>repeated .google.cloud.language.v1beta2.Entity entities = 1;</code> */ public Builder setEntities( int index, com.google.cloud.language.v1beta2.Entity.Builder builderForValue) { if (entitiesBuilder_ == null) { ensureEntitiesIsMutable(); entities_.set(index, builderForValue.build()); onChanged(); } else { entitiesBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * The recognized entities in the input document. * </pre> * * <code>repeated .google.cloud.language.v1beta2.Entity entities = 1;</code> */ public Builder setEntities( int index, com.google.cloud.language.v1beta2.Entity.Builder builderForValue) { if (entitiesBuilder_ == null) { ensureEntitiesIsMutable(); entities_.set(index, builderForValue.build()); onChanged(); } else { entitiesBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * The mentions of this entity in the input document. The API currently * supports proper noun mentions. * </pre> * * <code>repeated .google.cloud.language.v1beta2.EntityMention mentions = 5;</code> */ public Builder addMentions( int index, com.google.cloud.language.v1beta2.EntityMention.Builder builderForValue) { if (mentionsBuilder_ == null) { ensureMentionsIsMutable(); mentions_.add(index, builderForValue.build()); onChanged(); } else { mentionsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * The recognized entities in the input document with associated sentiments. * </pre> * * <code>repeated .google.cloud.language.v1beta2.Entity entities = 1;</code> */ public Builder addEntities( int index, com.google.cloud.language.v1beta2.Entity.Builder builderForValue) { if (entitiesBuilder_ == null) { ensureEntitiesIsMutable(); entities_.add(index, builderForValue.build()); onChanged(); } else { entitiesBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * The recognized entities in the input document with associated sentiments. * </pre> * * <code>repeated .google.cloud.language.v1beta2.Entity entities = 1;</code> */ public Builder addEntities(com.google.cloud.language.v1beta2.Entity.Builder builderForValue) { if (entitiesBuilder_ == null) { ensureEntitiesIsMutable(); entities_.add(builderForValue.build()); onChanged(); } else { entitiesBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * * * <pre> * 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. * </pre> * * <code>map<string, string> metadata = 3;</code> */ public java.lang.String getMetadataOrThrow(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, java.lang.String> map = internalGetMetadata().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); }