Class ImmutableCoord

java.lang.Object
org.kiwiproject.consul.model.coordinate.Coord
org.kiwiproject.consul.model.coordinate.ImmutableCoord

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableCoord extends Coord
Immutable implementation of Coord.

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

  • Method Details

    • getAdjustment

      public double getAdjustment()
      Specified by:
      getAdjustment in class Coord
      Returns:
      The value of the adjustment attribute
    • getError

      public double getError()
      Specified by:
      getError in class Coord
      Returns:
      The value of the error attribute
    • getHeight

      public double getHeight()
      Specified by:
      getHeight in class Coord
      Returns:
      The value of the height attribute
    • getVec

      public double[] getVec()
      Specified by:
      getVec in class Coord
      Returns:
      A cloned vec array
    • withAdjustment

      public final ImmutableCoord withAdjustment(double value)
      Copy the current immutable object by setting a value for the adjustment attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for adjustment
      Returns:
      A modified copy of the this object
    • withError

      public final ImmutableCoord withError(double value)
      Copy the current immutable object by setting a value for the error attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for error
      Returns:
      A modified copy of the this object
    • withHeight

      public final ImmutableCoord withHeight(double value)
      Copy the current immutable object by setting a value for the height attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for height
      Returns:
      A modified copy of the this object
    • withVec

      public final ImmutableCoord withVec(double... elements)
      Copy the current immutable object with elements that replace the content of vec. The array is cloned before being saved as attribute values.
      Parameters:
      elements - The non-null elements for vec
      Returns:
      A modified copy of this object
    • equals

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

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

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

      public static ImmutableCoord.Builder builder()
      Creates a builder for ImmutableCoord.
       ImmutableCoord.builder()
          .adjustment(double) // required adjustment
          .error(double) // required error
          .height(double) // required height
          .vec(double) // required vec
          .build();
       
      Returns:
      A new ImmutableCoord builder