Class ImmutableSession

java.lang.Object
org.kiwiproject.consul.model.session.Session
org.kiwiproject.consul.model.session.ImmutableSession

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableSession extends Session
Immutable implementation of Session.

Use the builder to create immutable instances: ImmutableSession.builder().

  • Method Details

    • getLockDelay

      public Optional<String> getLockDelay()
      Specified by:
      getLockDelay in class Session
      Returns:
      The value of the lockDelay attribute
    • getName

      public Optional<String> getName()
      Specified by:
      getName in class Session
      Returns:
      The value of the name attribute
    • getNode

      public Optional<String> getNode()
      Specified by:
      getNode in class Session
      Returns:
      The value of the node attribute
    • getChecks

      public com.google.common.collect.ImmutableList<String> getChecks()
      Specified by:
      getChecks in class Session
      Returns:
      The value of the checks attribute
    • getBehavior

      public Optional<String> getBehavior()
      Specified by:
      getBehavior in class Session
      Returns:
      The value of the behavior attribute
    • getTtl

      public Optional<String> getTtl()
      Specified by:
      getTtl in class Session
      Returns:
      The value of the ttl attribute
    • withLockDelay

      public final ImmutableSession withLockDelay(String value)
      Copy the current immutable object by setting a present value for the optional lockDelay attribute.
      Parameters:
      value - The value for lockDelay
      Returns:
      A modified copy of this object
    • withLockDelay

      public final ImmutableSession withLockDelay(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the lockDelay attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for lockDelay
      Returns:
      A modified copy of this object
    • withName

      public final ImmutableSession withName(String value)
      Copy the current immutable object by setting a present value for the optional name attribute.
      Parameters:
      value - The value for name
      Returns:
      A modified copy of this object
    • withName

      public final ImmutableSession withName(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the name attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for name
      Returns:
      A modified copy of this object
    • withNode

      public final ImmutableSession withNode(String value)
      Copy the current immutable object by setting a present value for the optional node attribute.
      Parameters:
      value - The value for node
      Returns:
      A modified copy of this object
    • withNode

      public final ImmutableSession withNode(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the node attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for node
      Returns:
      A modified copy of this object
    • withChecks

      public final ImmutableSession withChecks(String... elements)
      Copy the current immutable object with elements that replace the content of checks.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withChecks

      public final ImmutableSession withChecks(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of checks. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of checks elements to set
      Returns:
      A modified copy of this object
    • withBehavior

      public final ImmutableSession withBehavior(String value)
      Copy the current immutable object by setting a present value for the optional behavior attribute.
      Parameters:
      value - The value for behavior
      Returns:
      A modified copy of this object
    • withBehavior

      public final ImmutableSession withBehavior(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the behavior attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for behavior
      Returns:
      A modified copy of this object
    • withTtl

      public final ImmutableSession withTtl(String value)
      Copy the current immutable object by setting a present value for the optional ttl attribute.
      Parameters:
      value - The value for ttl
      Returns:
      A modified copy of this object
    • withTtl

      public final ImmutableSession withTtl(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the ttl attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for ttl
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableSession that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: lockDelay, name, node, checks, behavior, ttl.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Session with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableSession copyOf(Session instance)
      Creates an immutable copy of a Session value. 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 for ImmutableSession.
       ImmutableSession.builder()
          .lockDelay(String) // optional lockDelay
          .name(String) // optional name
          .node(String) // optional node
          .addChecks|addAllChecks(String) // checks elements
          .behavior(String) // optional behavior
          .ttl(String) // optional ttl
          .build();
       
      Returns:
      A new ImmutableSession builder