Package com.orbitz.consul.model.session
Class ImmutableSession.Builder
- java.lang.Object
-
- com.orbitz.consul.model.session.ImmutableSession.Builder
-
- Enclosing class:
- ImmutableSession
@NotThreadSafe public static final class ImmutableSession.Builder extends java.lang.ObjectBuilds instances of typeImmutableSession. 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 ImmutableSession.BuilderaddAllChecks(java.lang.Iterable<java.lang.String> elements)Adds elements tocheckslist.ImmutableSession.BuilderaddChecks(java.lang.String element)Adds one element tocheckslist.ImmutableSession.BuilderaddChecks(java.lang.String... elements)Adds elements tocheckslist.ImmutableSession.Builderbehavior(java.lang.String behavior)Initializes the optional valuebehaviorto behavior.ImmutableSession.Builderbehavior(java.util.Optional<java.lang.String> behavior)Initializes the optional valuebehaviorto behavior.ImmutableSessionbuild()Builds a newImmutableSession.ImmutableSession.Builderchecks(java.lang.Iterable<java.lang.String> elements)Sets or replaces all elements forcheckslist.ImmutableSession.Builderfrom(Session instance)Fill a builder with attribute values from the providedSessioninstance.ImmutableSession.BuilderlockDelay(java.lang.String lockDelay)Initializes the optional valuelockDelayto lockDelay.ImmutableSession.BuilderlockDelay(java.util.Optional<java.lang.String> lockDelay)Initializes the optional valuelockDelayto lockDelay.ImmutableSession.Buildername(java.lang.String name)Initializes the optional valuenameto name.ImmutableSession.Buildername(java.util.Optional<java.lang.String> name)Initializes the optional valuenameto name.ImmutableSession.Buildernode(java.lang.String node)Initializes the optional valuenodeto node.ImmutableSession.Buildernode(java.util.Optional<java.lang.String> node)Initializes the optional valuenodeto node.ImmutableSession.Builderttl(java.lang.String ttl)Initializes the optional valuettlto ttl.ImmutableSession.Builderttl(java.util.Optional<java.lang.String> ttl)Initializes the optional valuettlto ttl.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableSession.Builder from(Session instance)
Fill a builder with attribute values from the providedSessioninstance. 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
-
lockDelay
@CanIgnoreReturnValue public final ImmutableSession.Builder lockDelay(java.lang.String lockDelay)
Initializes the optional valuelockDelayto lockDelay.- Parameters:
lockDelay- The value for lockDelay- Returns:
thisbuilder for chained invocation
-
lockDelay
@CanIgnoreReturnValue public final ImmutableSession.Builder lockDelay(java.util.Optional<java.lang.String> lockDelay)
Initializes the optional valuelockDelayto lockDelay.- Parameters:
lockDelay- The value for lockDelay- Returns:
thisbuilder for use in a chained invocation
-
name
@CanIgnoreReturnValue public final ImmutableSession.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 ImmutableSession.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 ImmutableSession.Builder node(java.lang.String node)
Initializes the optional valuenodeto node.- Parameters:
node- The value for node- Returns:
thisbuilder for chained invocation
-
node
@CanIgnoreReturnValue public final ImmutableSession.Builder node(java.util.Optional<java.lang.String> node)
Initializes the optional valuenodeto node.- Parameters:
node- The value for node- Returns:
thisbuilder for use in a chained invocation
-
addChecks
@CanIgnoreReturnValue public final ImmutableSession.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 ImmutableSession.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 ImmutableSession.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 ImmutableSession.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 ImmutableSession.Builder behavior(java.lang.String behavior)
Initializes the optional valuebehaviorto behavior.- Parameters:
behavior- The value for behavior- Returns:
thisbuilder for chained invocation
-
behavior
@CanIgnoreReturnValue public final ImmutableSession.Builder behavior(java.util.Optional<java.lang.String> behavior)
Initializes the optional valuebehaviorto behavior.- Parameters:
behavior- The value for behavior- Returns:
thisbuilder for use in a chained invocation
-
ttl
@CanIgnoreReturnValue public final ImmutableSession.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 ImmutableSession.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
-
build
public ImmutableSession build()
Builds a newImmutableSession.- Returns:
- An immutable instance of Session
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-