Class ImmutableServiceWeights

java.lang.Object
org.kiwiproject.consul.model.catalog.ServiceWeights
org.kiwiproject.consul.model.catalog.ImmutableServiceWeights

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

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

  • Method Details

    • getPassing

      public int getPassing()
      Specified by:
      getPassing in class ServiceWeights
      Returns:
      The value of the passing attribute
    • getWarning

      public int getWarning()
      Specified by:
      getWarning in class ServiceWeights
      Returns:
      The value of the warning attribute
    • withPassing

      public final ImmutableServiceWeights withPassing(int value)
      Copy the current immutable object by setting a value for the passing attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for passing
      Returns:
      A modified copy of the this object
    • withWarning

      public final ImmutableServiceWeights withWarning(int value)
      Copy the current immutable object by setting a value for the warning attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for warning
      Returns:
      A modified copy of the this object
    • equals

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

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

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

      public static ImmutableServiceWeights.Builder builder()
      Creates a builder for ImmutableServiceWeights.
       ImmutableServiceWeights.builder()
          .passing(int) // required passing
          .warning(int) // required warning
          .build();
       
      Returns:
      A new ImmutableServiceWeights builder