Package com.orbitz.consul.model.session
Class ImmutableSession
- java.lang.Object
-
- com.orbitz.consul.model.session.Session
-
- com.orbitz.consul.model.session.ImmutableSession
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableSession.BuilderBuilds instances of typeImmutableSession.
-
Method Summary
Modifier and Type Method Description static ImmutableSession.Builderbuilder()Creates a builder forImmutableSession.static ImmutableSessioncopyOf(Session instance)Creates an immutable copy of aSessionvalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofImmutableSessionthat have equal attribute values.java.util.Optional<java.lang.String>getBehavior()com.google.common.collect.ImmutableList<java.lang.String>getChecks()java.util.Optional<java.lang.String>getLockDelay()java.util.Optional<java.lang.String>getName()java.util.Optional<java.lang.String>getNode()java.util.Optional<java.lang.String>getTtl()inthashCode()Computes a hash code from attributes:lockDelay,name,node,checks,behavior,ttl.java.lang.StringtoString()Prints the immutable valueSessionwith attribute values.ImmutableSessionwithBehavior(java.lang.String value)Copy the current immutable object by setting a present value for the optionalbehaviorattribute.ImmutableSessionwithBehavior(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for thebehaviorattribute.ImmutableSessionwithChecks(java.lang.Iterable<java.lang.String> elements)Copy the current immutable object with elements that replace the content ofchecks.ImmutableSessionwithChecks(java.lang.String... elements)Copy the current immutable object with elements that replace the content ofchecks.ImmutableSessionwithLockDelay(java.lang.String value)Copy the current immutable object by setting a present value for the optionallockDelayattribute.ImmutableSessionwithLockDelay(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for thelockDelayattribute.ImmutableSessionwithName(java.lang.String value)Copy the current immutable object by setting a present value for the optionalnameattribute.ImmutableSessionwithName(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for thenameattribute.ImmutableSessionwithNode(java.lang.String value)Copy the current immutable object by setting a present value for the optionalnodeattribute.ImmutableSessionwithNode(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for thenodeattribute.ImmutableSessionwithTtl(java.lang.String value)Copy the current immutable object by setting a present value for the optionalttlattribute.ImmutableSessionwithTtl(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for thettlattribute.
-
-
-
Method Detail
-
getLockDelay
public java.util.Optional<java.lang.String> getLockDelay()
- Specified by:
getLockDelayin classSession- Returns:
- The value of the
lockDelayattribute
-
getName
public java.util.Optional<java.lang.String> getName()
-
getNode
public java.util.Optional<java.lang.String> getNode()
-
getChecks
public com.google.common.collect.ImmutableList<java.lang.String> getChecks()
-
getBehavior
public java.util.Optional<java.lang.String> getBehavior()
- Specified by:
getBehaviorin classSession- Returns:
- The value of the
behaviorattribute
-
getTtl
public java.util.Optional<java.lang.String> getTtl()
-
withLockDelay
public final ImmutableSession withLockDelay(java.lang.String value)
Copy the current immutable object by setting a present value for the optionallockDelayattribute.- Parameters:
value- The value for lockDelay- Returns:
- A modified copy of
thisobject
-
withLockDelay
public final ImmutableSession withLockDelay(java.util.Optional<java.lang.String> optional)
Copy the current immutable object by setting an optional value for thelockDelayattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for lockDelay- Returns:
- A modified copy of
thisobject
-
withName
public final ImmutableSession withName(java.lang.String value)
Copy the current immutable object by setting a present value for the optionalnameattribute.- Parameters:
value- The value for name- Returns:
- A modified copy of
thisobject
-
withName
public final ImmutableSession withName(java.util.Optional<java.lang.String> optional)
Copy the current immutable object by setting an optional value for thenameattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for name- Returns:
- A modified copy of
thisobject
-
withNode
public final ImmutableSession withNode(java.lang.String value)
Copy the current immutable object by setting a present value for the optionalnodeattribute.- Parameters:
value- The value for node- Returns:
- A modified copy of
thisobject
-
withNode
public final ImmutableSession withNode(java.util.Optional<java.lang.String> optional)
Copy the current immutable object by setting an optional value for thenodeattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for node- Returns:
- A modified copy of
thisobject
-
withChecks
public final ImmutableSession withChecks(java.lang.String... elements)
Copy the current immutable object with elements that replace the content ofchecks.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withChecks
public final ImmutableSession withChecks(java.lang.Iterable<java.lang.String> elements)
Copy the current immutable object with elements that replace the content ofchecks. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of checks elements to set- Returns:
- A modified copy of
thisobject
-
withBehavior
public final ImmutableSession withBehavior(java.lang.String value)
Copy the current immutable object by setting a present value for the optionalbehaviorattribute.- Parameters:
value- The value for behavior- Returns:
- A modified copy of
thisobject
-
withBehavior
public final ImmutableSession withBehavior(java.util.Optional<java.lang.String> optional)
Copy the current immutable object by setting an optional value for thebehaviorattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for behavior- Returns:
- A modified copy of
thisobject
-
withTtl
public final ImmutableSession withTtl(java.lang.String value)
Copy the current immutable object by setting a present value for the optionalttlattribute.- Parameters:
value- The value for ttl- Returns:
- A modified copy of
thisobject
-
withTtl
public final ImmutableSession withTtl(java.util.Optional<java.lang.String> optional)
Copy the current immutable object by setting an optional value for thettlattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for ttl- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofImmutableSessionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:lockDelay,name,node,checks,behavior,ttl.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueSessionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableSession copyOf(Session instance)
Creates an immutable copy of aSessionvalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Session instance
-
builder
public static ImmutableSession.Builder builder()
Creates a builder forImmutableSession.ImmutableSession.builder() .lockDelay(String) // optionallockDelay.name(String) // optionalname.node(String) // optionalnode.addChecks|addAllChecks(String) //checkselements .behavior(String) // optionalbehavior.ttl(String) // optionalttl.build();- Returns:
- A new ImmutableSession builder
-
-