/** * Creates a builder for {@link ImmutableSessionInfo ImmutableSessionInfo}. * @return A new ImmutableSessionInfo builder */ public static ImmutableSessionInfo.Builder builder() { return new ImmutableSessionInfo.Builder(); }
/** * Creates a builder for {@link ImmutableSessionCreatedResponse ImmutableSessionCreatedResponse}. * @return A new ImmutableSessionCreatedResponse builder */ public static ImmutableSessionCreatedResponse.Builder builder() { return new ImmutableSessionCreatedResponse.Builder(); }
/** * Creates an immutable copy of a {@link Session} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable Session instance */ public static ImmutableSession copyOf(Session instance) { if (instance instanceof ImmutableSession) { return (ImmutableSession) instance; } return ImmutableSession.builder() .from(instance) .build(); }
/** * Fill a builder with attribute values from the provided {@code SessionCreatedResponse} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SessionCreatedResponse instance) { Preconditions.checkNotNull(instance, "instance"); id(instance.getId()); return this; }
/** * Creates an immutable copy of a {@link SessionInfo} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable SessionInfo instance */ public static ImmutableSessionInfo copyOf(SessionInfo instance) { if (instance instanceof ImmutableSessionInfo) { return (ImmutableSessionInfo) instance; } return ImmutableSessionInfo.builder() .from(instance) .build(); }
/** * Creates an immutable copy of a {@link SessionCreatedResponse} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable SessionCreatedResponse instance */ public static ImmutableSessionCreatedResponse copyOf(SessionCreatedResponse instance) { if (instance instanceof ImmutableSessionCreatedResponse) { return (ImmutableSessionCreatedResponse) instance; } return ImmutableSessionCreatedResponse.builder() .from(instance) .build(); }
/** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the <em>Jackson</em>-binding infrastructure */ @Deprecated @JsonCreator static ImmutableSessionCreatedResponse fromJson(Json json) { ImmutableSessionCreatedResponse.Builder builder = ImmutableSessionCreatedResponse.builder(); if (json.id != null) { builder.id(json.id); } return builder.build(); }
ConsulClusterMember(SessionInfo info) { this(info.getId()); }
/** * Builds a new {@link ImmutableSessionCreatedResponse ImmutableSessionCreatedResponse}. * @return An immutable instance of SessionCreatedResponse * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableSessionCreatedResponse build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableSessionCreatedResponse(id); }
/** * Builds a new {@link ImmutableSessionInfo ImmutableSessionInfo}. * @return An immutable instance of SessionInfo * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableSessionInfo build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableSessionInfo(createIndex, lockDelay, name, node, checksBuilder.build(), behavior, ttl, id); }
/** * Copy the current immutable object with elements that replace the content of {@link Session#getChecks() checks}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableSession withChecks(String... elements) { ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableSession(this.lockDelay, this.name, this.node, newValue, this.behavior, this.ttl); }
/** * Creates a builder for {@link ImmutableSession ImmutableSession}. * @return A new ImmutableSession builder */ public static ImmutableSession.Builder builder() { return new ImmutableSession.Builder(); }
/** * Copy the current immutable object by setting a value for the {@link SessionInfo#getCreateIndex() createIndex} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for createIndex * @return A modified copy of the {@code this} object */ public final ImmutableSessionInfo withCreateIndex(long value) { if (this.createIndex == value) return this; return new ImmutableSessionInfo(value, this.lockDelay, this.name, this.node, this.checks, this.behavior, this.ttl, this.id); }
/** * Sets or replaces all elements for {@link SessionInfo#getChecks() checks} list. * @param elements An iterable of checks elements * @return {@code this} builder for use in a chained invocation */ public final Builder checks(Iterable<String> elements) { checksBuilder = ImmutableList.builder(); return addAllChecks(elements); }
/** * This instance is equal to all instances of {@code ImmutableSession} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImmutableSession && equalTo((ImmutableSession) another); }
/** * Sets or replaces all elements for {@link Session#getChecks() checks} list. * @param elements An iterable of checks elements * @return {@code this} builder for use in a chained invocation */ public final Builder checks(Iterable<String> elements) { checksBuilder = ImmutableList.builder(); return addAllChecks(elements); }
/** * Copy the current immutable object with elements that replace the content of {@link Session#getChecks() checks}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of checks elements to set * @return A modified copy of {@code this} object */ public final ImmutableSession withChecks(Iterable<String> elements) { if (this.checks == elements) return this; ImmutableList<String> newValue = ImmutableList.copyOf(elements); return new ImmutableSession(this.lockDelay, this.name, this.node, newValue, this.behavior, this.ttl); }
/** * Builds a new {@link ImmutableSession ImmutableSession}. * @return An immutable instance of Session * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableSession build() { return new ImmutableSession(lockDelay, name, node, checksBuilder.build(), behavior, ttl); } }