Class ImmutableDatacenter

java.lang.Object
org.kiwiproject.consul.model.coordinate.Datacenter
org.kiwiproject.consul.model.coordinate.ImmutableDatacenter

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

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

  • Method Details

    • getDatacenter

      public String getDatacenter()
      Specified by:
      getDatacenter in class Datacenter
      Returns:
      The value of the datacenter attribute
    • getCoordinates

      public com.google.common.collect.ImmutableList<Coordinate> getCoordinates()
      Specified by:
      getCoordinates in class Datacenter
      Returns:
      The value of the coordinates attribute
    • withDatacenter

      public final ImmutableDatacenter withDatacenter(String value)
      Copy the current immutable object by setting a value for the datacenter attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for datacenter
      Returns:
      A modified copy of the this object
    • withCoordinates

      public final ImmutableDatacenter withCoordinates(Coordinate... elements)
      Copy the current immutable object with elements that replace the content of coordinates.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withCoordinates

      public final ImmutableDatacenter withCoordinates(Iterable<? extends Coordinate> elements)
      Copy the current immutable object with elements that replace the content of coordinates. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of coordinates elements to set
      Returns:
      A modified copy of this object
    • equals

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

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

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

      public static ImmutableDatacenter.Builder builder()
      Creates a builder for ImmutableDatacenter.
       ImmutableDatacenter.builder()
          .datacenter(String) // required datacenter
          .addCoordinates|addAllCoordinates(org.kiwiproject.consul.model.coordinate.Coordinate) // coordinates elements
          .build();
       
      Returns:
      A new ImmutableDatacenter builder