Package com.orbitz.consul.model.session
Class ImmutableSessionInfo.Builder
- java.lang.Object
-
- com.orbitz.consul.model.session.ImmutableSessionInfo.Builder
-
- Enclosing class:
- ImmutableSessionInfo
@NotThreadSafe public static final class ImmutableSessionInfo.Builder extends java.lang.ObjectBuilds instances of typeImmutableSessionInfo. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
Modifier and Type Method Description ImmutableSessionInfo.BuilderaddAllChecks(java.lang.Iterable<java.lang.String> elements)Adds elements tocheckslist.ImmutableSessionInfo.BuilderaddChecks(java.lang.String element)Adds one element tocheckslist.ImmutableSessionInfo.BuilderaddChecks(java.lang.String... elements)Adds elements tocheckslist.ImmutableSessionInfo.Builderbehavior(java.lang.String behavior)Initializes the value for thebehaviorattribute.ImmutableSessionInfobuild()Builds a newImmutableSessionInfo.ImmutableSessionInfo.Builderchecks(java.lang.Iterable<java.lang.String> elements)Sets or replaces all elements forcheckslist.ImmutableSessionInfo.BuildercreateIndex(long createIndex)Initializes the value for thecreateIndexattribute.ImmutableSessionInfo.Builderfrom(SessionInfo instance)Fill a builder with attribute values from the providedSessionInfoinstance.ImmutableSessionInfo.Builderid(java.lang.String id)Initializes the value for theidattribute.ImmutableSessionInfo.BuilderlockDelay(java.lang.Long lockDelay)Initializes the value for thelockDelayattribute.ImmutableSessionInfo.Buildername(java.lang.String name)Initializes the optional valuenameto name.ImmutableSessionInfo.Buildername(java.util.Optional<java.lang.String> name)Initializes the optional valuenameto name.ImmutableSessionInfo.Buildernode(java.lang.String node)Initializes the value for thenodeattribute.ImmutableSessionInfo.Builderttl(java.lang.String ttl)Initializes the optional valuettlto ttl.ImmutableSessionInfo.Builderttl(java.util.Optional<java.lang.String> ttl)Initializes the optional valuettlto ttl.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder from(SessionInfo instance)
Fill a builder with attribute values from the providedSessionInfoinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
createIndex
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder createIndex(long createIndex)
Initializes the value for thecreateIndexattribute.- Parameters:
createIndex- The value for createIndex- Returns:
thisbuilder for use in a chained invocation
-
lockDelay
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder lockDelay(java.lang.Long lockDelay)
Initializes the value for thelockDelayattribute.- Parameters:
lockDelay- The value for lockDelay- Returns:
thisbuilder for use in a chained invocation
-
name
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder name(java.lang.String name)
Initializes the optional valuenameto name.- Parameters:
name- The value for name- Returns:
thisbuilder for chained invocation
-
name
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder name(java.util.Optional<java.lang.String> name)
Initializes the optional valuenameto name.- Parameters:
name- The value for name- Returns:
thisbuilder for use in a chained invocation
-
node
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder node(java.lang.String node)
Initializes the value for thenodeattribute.- Parameters:
node- The value for node- Returns:
thisbuilder for use in a chained invocation
-
addChecks
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder addChecks(java.lang.String element)
Adds one element tocheckslist.- Parameters:
element- A checks element- Returns:
thisbuilder for use in a chained invocation
-
addChecks
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder addChecks(java.lang.String... elements)
Adds elements tocheckslist.- Parameters:
elements- An array of checks elements- Returns:
thisbuilder for use in a chained invocation
-
checks
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder checks(java.lang.Iterable<java.lang.String> elements)
Sets or replaces all elements forcheckslist.- Parameters:
elements- An iterable of checks elements- Returns:
thisbuilder for use in a chained invocation
-
addAllChecks
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder addAllChecks(java.lang.Iterable<java.lang.String> elements)
Adds elements tocheckslist.- Parameters:
elements- An iterable of checks elements- Returns:
thisbuilder for use in a chained invocation
-
behavior
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder behavior(java.lang.String behavior)
Initializes the value for thebehaviorattribute.- Parameters:
behavior- The value for behavior- Returns:
thisbuilder for use in a chained invocation
-
ttl
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder ttl(java.lang.String ttl)
Initializes the optional valuettlto ttl.- Parameters:
ttl- The value for ttl- Returns:
thisbuilder for chained invocation
-
ttl
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder ttl(java.util.Optional<java.lang.String> ttl)
Initializes the optional valuettlto ttl.- Parameters:
ttl- The value for ttl- Returns:
thisbuilder for use in a chained invocation
-
id
@CanIgnoreReturnValue public final ImmutableSessionInfo.Builder id(java.lang.String id)
Initializes the value for theidattribute.- Parameters:
id- The value for id- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableSessionInfo build()
Builds a newImmutableSessionInfo.- Returns:
- An immutable instance of SessionInfo
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-