@SuppressWarnings({"rawtypes"}) @java.lang.Override protected com.google.protobuf.MapField internalGetMapField(int number) { switch (number) { case 2: return internalGetLabels(); default: throw new RuntimeException("Invalid map field number: " + number); } }
public int getLabelsCount() { return internalGetLabels().getMap().size(); } /**
/** * * * <pre> * The labels for the session. * * Label keys must be between 1 and 63 characters long and must conform to * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * * Label values must be between 0 and 63 characters long and must conform * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * * No more than 64 labels can be associated with a given session. * See https://goo.gl/xmQnxf for more information on and examples of labels. * </pre> * * <code>map<string, string> labels = 2;</code> */ public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() { return internalGetLabels().getMap(); } /**
/** * * * <pre> * The labels for the session. * * Label keys must be between 1 and 63 characters long and must conform to * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * * Label values must be between 0 and 63 characters long and must conform * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * * No more than 64 labels can be associated with a given session. * See https://goo.gl/xmQnxf for more information on and examples of labels. * </pre> * * <code>map<string, string> labels = 2;</code> */ public java.lang.String getLabelsOrThrow(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); if (!map.containsKey(key)) { throw new java.lang.IllegalArgumentException(); } return map.get(key); }
/** * * * <pre> * The labels for the session. * * Label keys must be between 1 and 63 characters long and must conform to * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * * Label values must be between 0 and 63 characters long and must conform * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * * No more than 64 labels can be associated with a given session. * See https://goo.gl/xmQnxf for more information on and examples of labels. * </pre> * * <code>map<string, string> labels = 2;</code> */ public boolean containsLabels(java.lang.String key) { if (key == null) { throw new java.lang.NullPointerException(); } return internalGetLabels().getMap().containsKey(key); } /** Use {@link #getLabelsMap()} instead. */
/** * * * <pre> * The labels for the session. * * Label keys must be between 1 and 63 characters long and must conform to * the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * * Label values must be between 0 and 63 characters long and must conform * to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * * No more than 64 labels can be associated with a given session. * See https://goo.gl/xmQnxf for more information on and examples of labels. * </pre> * * <code>map<string, string> labels = 2;</code> */ public java.lang.String getLabelsOrDefault(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 = internalGetLabels().getMap(); return map.containsKey(key) ? map.get(key) : defaultValue; } /**
@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_); } com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 2); if (createTime_ != null) { output.writeMessage(3, getCreateTime()); } if (approximateLastUseTime_ != null) { output.writeMessage(4, getApproximateLastUseTime()); } unknownFields.writeTo(output); }
@java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (!getNameBytes().isEmpty()) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); } for (java.util.Map.Entry<java.lang.String, java.lang.String> entry : internalGetLabels().getMap().entrySet()) { com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ = LabelsDefaultEntryHolder.defaultEntry .newBuilderForType() .setKey(entry.getKey()) .setValue(entry.getValue()) .build(); size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, labels__); } if (createTime_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCreateTime()); } if (approximateLastUseTime_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getApproximateLastUseTime()); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; }
@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(); if (!internalGetLabels().getMap().isEmpty()) { hash = (37 * hash) + LABELS_FIELD_NUMBER; hash = (53 * hash) + internalGetLabels().hashCode(); } if (hasCreateTime()) { hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; hash = (53 * hash) + getCreateTime().hashCode(); } if (hasApproximateLastUseTime()) { hash = (37 * hash) + APPROXIMATE_LAST_USE_TIME_FIELD_NUMBER; hash = (53 * hash) + getApproximateLastUseTime().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.spanner.v1.Session)) { return super.equals(obj); } com.google.spanner.v1.Session other = (com.google.spanner.v1.Session) obj; boolean result = true; result = result && getName().equals(other.getName()); result = result && internalGetLabels().equals(other.internalGetLabels()); result = result && (hasCreateTime() == other.hasCreateTime()); if (hasCreateTime()) { result = result && getCreateTime().equals(other.getCreateTime()); } result = result && (hasApproximateLastUseTime() == other.hasApproximateLastUseTime()); if (hasApproximateLastUseTime()) { result = result && getApproximateLastUseTime().equals(other.getApproximateLastUseTime()); } result = result && unknownFields.equals(other.unknownFields); return result; }