@SuppressWarnings({"rawtypes"}) @java.lang.Override protected com.google.protobuf.MapField internalGetMapField(int number) { switch (number) { case 3: return internalGetMetadata(); default: throw new RuntimeException("Invalid map field number: " + number); } }
public int getMetadataCount() { return internalGetMetadata().getMap().size(); } /**
/** * * * <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.util.Map<java.lang.String, java.lang.String> getMetadataMap() { return internalGetMetadata().getMap(); } /**
/** * * * <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 boolean containsMetadata(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetMetadata().getMap().containsKey(key); } /** Use {@link #getMetadataMap()} instead. */
/** * * * <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 getMetadataOrDefault( java.lang.String key, java.lang.String defaultValue) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, java.lang.String> map = internalGetMetadata().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /**
/** * * * <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); }
@java.lang.Override 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.v1beta2.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)); } if (sentiment_ != null) { output.writeMessage(6, getSentiment()); } unknownFields.writeTo(output); }
internalGetMetadata().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, java.lang.String> metadata__ = MetadataDefaultEntryHolder.defaultEntry
@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(); } if (hasSentiment()) { hash = (37 * hash) + SENTIMENT_FIELD_NUMBER; hash = (53 * hash) + getSentiment().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.cloud.language.v1beta2.Entity)) { return super.equals(obj); } com.google.cloud.language.v1beta2.Entity other = (com.google.cloud.language.v1beta2.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()); result = result && (hasSentiment() == other.hasSentiment()); if (hasSentiment()) { result = result && getSentiment().equals(other.getSentiment()); } result = result && unknownFields.equals(other.unknownFields); return result; }