Class ImmutableSession.Builder

java.lang.Object
org.kiwiproject.consul.model.session.ImmutableSession.Builder
Enclosing class:
ImmutableSession

public static final class ImmutableSession.Builder extends Object
Builds instances of type ImmutableSession. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      @CanIgnoreReturnValue public final ImmutableSession.Builder from(Session instance)
      Fill a builder with attribute values from the provided Session instance. 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:
      this builder for use in a chained invocation
    • lockDelay

      @CanIgnoreReturnValue public final ImmutableSession.Builder lockDelay(String lockDelay)
      Initializes the optional value lockDelay to lockDelay.
      Parameters:
      lockDelay - The value for lockDelay
      Returns:
      this builder for chained invocation
    • lockDelay

      @CanIgnoreReturnValue public final ImmutableSession.Builder lockDelay(Optional<String> lockDelay)
      Initializes the optional value lockDelay to lockDelay.
      Parameters:
      lockDelay - The value for lockDelay
      Returns:
      this builder for use in a chained invocation
    • name

      @CanIgnoreReturnValue public final ImmutableSession.Builder name(String name)
      Initializes the optional value name to name.
      Parameters:
      name - The value for name
      Returns:
      this builder for chained invocation
    • name

      @CanIgnoreReturnValue public final ImmutableSession.Builder name(Optional<String> name)
      Initializes the optional value name to name.
      Parameters:
      name - The value for name
      Returns:
      this builder for use in a chained invocation
    • node

      @CanIgnoreReturnValue public final ImmutableSession.Builder node(String node)
      Initializes the optional value node to node.
      Parameters:
      node - The value for node
      Returns:
      this builder for chained invocation
    • node

      @CanIgnoreReturnValue public final ImmutableSession.Builder node(Optional<String> node)
      Initializes the optional value node to node.
      Parameters:
      node - The value for node
      Returns:
      this builder for use in a chained invocation
    • addChecks

      @CanIgnoreReturnValue public final ImmutableSession.Builder addChecks(String element)
      Adds one element to checks list.
      Parameters:
      element - A checks element
      Returns:
      this builder for use in a chained invocation
    • addChecks

      @CanIgnoreReturnValue public final ImmutableSession.Builder addChecks(String... elements)
      Adds elements to checks list.
      Parameters:
      elements - An array of checks elements
      Returns:
      this builder for use in a chained invocation
    • checks

      @CanIgnoreReturnValue public final ImmutableSession.Builder checks(Iterable<String> elements)
      Sets or replaces all elements for checks list.
      Parameters:
      elements - An iterable of checks elements
      Returns:
      this builder for use in a chained invocation
    • addAllChecks

      @CanIgnoreReturnValue public final ImmutableSession.Builder addAllChecks(Iterable<String> elements)
      Adds elements to checks list.
      Parameters:
      elements - An iterable of checks elements
      Returns:
      this builder for use in a chained invocation
    • behavior

      @CanIgnoreReturnValue public final ImmutableSession.Builder behavior(String behavior)
      Initializes the optional value behavior to behavior.
      Parameters:
      behavior - The value for behavior
      Returns:
      this builder for chained invocation
    • behavior

      @CanIgnoreReturnValue public final ImmutableSession.Builder behavior(Optional<String> behavior)
      Initializes the optional value behavior to behavior.
      Parameters:
      behavior - The value for behavior
      Returns:
      this builder for use in a chained invocation
    • ttl

      @CanIgnoreReturnValue public final ImmutableSession.Builder ttl(String ttl)
      Initializes the optional value ttl to ttl.
      Parameters:
      ttl - The value for ttl
      Returns:
      this builder for chained invocation
    • ttl

      @CanIgnoreReturnValue public final ImmutableSession.Builder ttl(Optional<String> ttl)
      Initializes the optional value ttl to ttl.
      Parameters:
      ttl - The value for ttl
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableSession build()
      Builds a new ImmutableSession.
      Returns:
      An immutable instance of Session
      Throws:
      IllegalStateException - if any required attributes are missing