@java.lang.Override public Builder newBuilderForType() { return newBuilder(); }
public Builder mergeFrom(com.google.spanner.v1.Session other) { if (other == com.google.spanner.v1.Session.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); if (other.hasCreateTime()) { mergeCreateTime(other.getCreateTime()); } if (other.hasApproximateLastUseTime()) { mergeApproximateLastUseTime(other.getApproximateLastUseTime()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@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; }
/** * * * <pre> * The name of the session. This is always system-assigned; values provided * when creating a session are ignored. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
@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; }
@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 com.google.spanner.v1.Session getDefaultInstanceForType() { return com.google.spanner.v1.Session.getDefaultInstance(); }
Session createSession(final DatabaseId db) throws SpannerException { final Map<SpannerRpc.Option, ?> options = optionMap(SessionOption.channelHint(random.nextLong())); Span span = tracer.spanBuilder(CREATE_SESSION).startSpan(); try (Scope s = tracer.withSpan(span)) { com.google.spanner.v1.Session session = runWithRetries( new Callable<com.google.spanner.v1.Session>() { @Override public com.google.spanner.v1.Session call() throws Exception { return gapicRpc.createSession( db.getName(), getOptions().getSessionLabels(), options); } }); span.end(); return new SessionImpl(session.getName(), options); } catch (RuntimeException e) { TraceUtil.endSpanWithFailure(span, e); throw e; } }
/** * * * <pre> * Output only. The timestamp when the session is created. * </pre> * * <code>.google.protobuf.Timestamp create_time = 3;</code> */ public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { return getCreateTime(); }
/** * * * <pre> * Output only. The approximate timestamp when the session is last used. It is * typically earlier than the actual last use time. * </pre> * * <code>.google.protobuf.Timestamp approximate_last_use_time = 4;</code> */ public com.google.protobuf.TimestampOrBuilder getApproximateLastUseTimeOrBuilder() { return getApproximateLastUseTime(); }
/** Use {@link #getLabelsMap()} instead. */ @java.lang.Deprecated public java.util.Map<java.lang.String, java.lang.String> getLabels() { return getLabelsMap(); } /**
@java.lang.Override public com.google.spanner.v1.Session buildPartial() { com.google.spanner.v1.Session result = new com.google.spanner.v1.Session(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; result.name_ = name_; result.labels_ = internalGetLabels(); result.labels_.makeImmutable(); if (createTimeBuilder_ == null) { result.createTime_ = createTime_; } else { result.createTime_ = createTimeBuilder_.build(); } if (approximateLastUseTimeBuilder_ == null) { result.approximateLastUseTime_ = approximateLastUseTime_; } else { result.approximateLastUseTime_ = approximateLastUseTimeBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.spanner.v1.CreateSessionRequest)) { return super.equals(obj); } com.google.spanner.v1.CreateSessionRequest other = (com.google.spanner.v1.CreateSessionRequest) obj; boolean result = true; result = result && getDatabase().equals(other.getDatabase()); result = result && (hasSession() == other.hasSession()); if (hasSession()) { result = result && getSession().equals(other.getSession()); } result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * The session to create. * </pre> * * <code>.google.spanner.v1.Session session = 2;</code> */ public com.google.spanner.v1.Session getSession() { return session_ == null ? com.google.spanner.v1.Session.getDefaultInstance() : session_; } /**
@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; }
Session createSession(final DatabaseId db) throws SpannerException { final Map<SpannerRpc.Option, ?> options = optionMap(SessionOption.channelHint(random.nextLong())); Span span = tracer.spanBuilder(CREATE_SESSION).startSpan(); try (Scope s = tracer.withSpan(span)) { com.google.spanner.v1.Session session = runWithRetries( new Callable<com.google.spanner.v1.Session>() { @Override public com.google.spanner.v1.Session call() throws Exception { return gapicRpc.createSession( db.getName(), getOptions().getSessionLabels(), options); } }); span.end(); return new SessionImpl(session.getName(), options); } catch (RuntimeException e) { TraceUtil.endSpanWithFailure(span, e); throw e; } }
/** * * * <pre> * The session to create. * </pre> * * <code>.google.spanner.v1.Session session = 2;</code> */ public Builder mergeSession(com.google.spanner.v1.Session value) { if (sessionBuilder_ == null) { if (session_ != null) { session_ = com.google.spanner.v1.Session.newBuilder(session_).mergeFrom(value).buildPartial(); } else { session_ = value; } onChanged(); } else { sessionBuilder_.mergeFrom(value); } return this; } /**
/** * * * <pre> * The session to create. * </pre> * * <code>.google.spanner.v1.Session session = 2;</code> */ public com.google.spanner.v1.SessionOrBuilder getSessionOrBuilder() { if (sessionBuilder_ != null) { return sessionBuilder_.getMessageOrBuilder(); } else { return session_ == null ? com.google.spanner.v1.Session.getDefaultInstance() : session_; } } /**
@Override public Session createSession( String databaseName, @Nullable Map<String, String> labels, @Nullable Map<Option, ?> options) throws SpannerException { CreateSessionRequest.Builder requestBuilder = CreateSessionRequest.newBuilder().setDatabase(databaseName); if (labels != null && !labels.isEmpty()) { Session.Builder session = Session.newBuilder().putAllLabels(labels); requestBuilder.setSession(session); } CreateSessionRequest request = requestBuilder.build(); GrpcCallContext context = newCallContext(options, databaseName); return get(spannerStub.createSessionCallable().futureCall(request, context)); }
/** * * * <pre> * The session to create. * </pre> * * <code>.google.spanner.v1.Session session = 2;</code> */ public com.google.spanner.v1.Session getSession() { if (sessionBuilder_ == null) { return session_ == null ? com.google.spanner.v1.Session.getDefaultInstance() : session_; } else { return sessionBuilder_.getMessage(); } } /**