Class ImmutableServiceIdentity

java.lang.Object
org.kiwiproject.consul.model.acl.Token.ServiceIdentity
org.kiwiproject.consul.model.acl.ImmutableServiceIdentity

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableServiceIdentity extends Token.ServiceIdentity
Immutable implementation of Token.ServiceIdentity.

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

  • Method Details

    • name

      public String name()
      Specified by:
      name in class Token.ServiceIdentity
      Returns:
      The value of the name attribute
    • datacenters

      public com.google.common.collect.ImmutableList<String> datacenters()
      Specified by:
      datacenters in class Token.ServiceIdentity
      Returns:
      The value of the datacenters attribute
    • withName

      public final ImmutableServiceIdentity 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
    • withDatacenters

      public final ImmutableServiceIdentity withDatacenters(String... elements)
      Copy the current immutable object with elements that replace the content of datacenters.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withDatacenters

      public final ImmutableServiceIdentity withDatacenters(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of datacenters. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of datacenters 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 ImmutableServiceIdentity 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: name, datacenters.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableServiceIdentity copyOf(Token.ServiceIdentity instance)
      Creates an immutable copy of a Token.ServiceIdentity 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 ServiceIdentity instance
    • builder

      public static ImmutableServiceIdentity.Builder builder()
      Creates a builder for ImmutableServiceIdentity.
       ImmutableServiceIdentity.builder()
          .name(String) // required name
          .addDatacenters|addAllDatacenters(String) // datacenters elements
          .build();
       
      Returns:
      A new ImmutableServiceIdentity builder