Class ImmutablePolicy

java.lang.Object
org.kiwiproject.consul.model.acl.Policy
org.kiwiproject.consul.model.acl.ImmutablePolicy

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

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

  • Method Details

    • id

      public Optional<String> id()
      Specified by:
      id in class Policy
      Returns:
      The value of the id attribute
    • description

      public Optional<String> description()
      Specified by:
      description in class Policy
      Returns:
      The value of the description attribute
    • name

      public String name()
      Specified by:
      name in class Policy
      Returns:
      The value of the name attribute
    • rules

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

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

      public final ImmutablePolicy withId(String value)
      Copy the current immutable object by setting a present value for the optional id attribute.
      Parameters:
      value - The value for id
      Returns:
      A modified copy of this object
    • withId

      public final ImmutablePolicy withId(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the id 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 id
      Returns:
      A modified copy of this object
    • withDescription

      public final ImmutablePolicy withDescription(String value)
      Copy the current immutable object by setting a present value for the optional description attribute.
      Parameters:
      value - The value for description
      Returns:
      A modified copy of this object
    • withDescription

      public final ImmutablePolicy withDescription(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the description 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 description
      Returns:
      A modified copy of this object
    • withName

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

      public final ImmutablePolicy withRules(String value)
      Copy the current immutable object by setting a present value for the optional rules attribute.
      Parameters:
      value - The value for rules
      Returns:
      A modified copy of this object
    • withRules

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

      public final ImmutablePolicy 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 ImmutablePolicy 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 ImmutablePolicy 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: id, description, name, rules, datacenters.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutablePolicy.Builder builder()
      Creates a builder for ImmutablePolicy.
       ImmutablePolicy.builder()
          .id(String) // optional id
          .description(String) // optional description
          .name(String) // required name
          .rules(String) // optional rules
          .datacenters(List&lt;String&gt;) // optional datacenters
          .build();
       
      Returns:
      A new ImmutablePolicy builder