Class ImmutableFailover

java.lang.Object
org.kiwiproject.consul.model.query.Failover
org.kiwiproject.consul.model.query.ImmutableFailover

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

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

  • Method Details

    • getNearestN

      public Optional<Integer> getNearestN()
      Specified by:
      getNearestN in class Failover
      Returns:
      The value of the nearestN attribute
    • datacenters

      public Optional<List<String>> datacenters()
      Specified by:
      datacenters in class Failover
      Returns:
      The value of the datacenters attribute
    • withNearestN

      public final ImmutableFailover withNearestN(int value)
      Copy the current immutable object by setting a present value for the optional nearestN attribute.
      Parameters:
      value - The value for nearestN
      Returns:
      A modified copy of this object
    • withNearestN

      public final ImmutableFailover withNearestN(Optional<Integer> optional)
      Copy the current immutable object by setting an optional value for the nearestN 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 nearestN
      Returns:
      A modified copy of this object
    • withDatacenters

      public final ImmutableFailover withDatacenters(List<String> value)
      Copy the current immutable object by setting a present value for the optional datacenters attribute.
      Parameters:
      value - The value for datacenters
      Returns:
      A modified copy of this object
    • withDatacenters

      public final ImmutableFailover withDatacenters(Optional<? extends List<String>> optional)
      Copy the current immutable object by setting an optional value for the datacenters attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for datacenters
      Returns:
      A modified copy of this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableFailover 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: nearestN, datacenters.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableFailover copyOf(Failover instance)
      Creates an immutable copy of a Failover 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 Failover instance
    • builder

      public static ImmutableFailover.Builder builder()
      Creates a builder for ImmutableFailover.
       ImmutableFailover.builder()
          .nearestN(Integer) // optional nearestN
          .datacenters(List&lt;String&gt;) // optional datacenters
          .build();
       
      Returns:
      A new ImmutableFailover builder