Class ImmutableRole

java.lang.Object
org.kiwiproject.consul.model.acl.Role
org.kiwiproject.consul.model.acl.ImmutableRole

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

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

  • Method Details

    • name

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

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

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

      public com.google.common.collect.ImmutableList<Role.RolePolicyLink> policies()
      Specified by:
      policies in class Role
      Returns:
      The value of the policies attribute
    • serviceIdentities

      public com.google.common.collect.ImmutableList<Role.RoleServiceIdentity> serviceIdentities()
      Specified by:
      serviceIdentities in class Role
      Returns:
      The value of the serviceIdentities attribute
    • nodeIdentities

      public com.google.common.collect.ImmutableList<Role.RoleNodeIdentity> nodeIdentities()
      Specified by:
      nodeIdentities in class Role
      Returns:
      The value of the nodeIdentities attribute
    • namespace

      public Optional<String> namespace()
      Specified by:
      namespace in class Role
      Returns:
      The value of the namespace attribute
    • withName

      public final ImmutableRole 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
    • withId

      public final ImmutableRole 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 ImmutableRole 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 ImmutableRole 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 ImmutableRole 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
    • withPolicies

      public final ImmutableRole withPolicies(Role.RolePolicyLink... elements)
      Copy the current immutable object with elements that replace the content of policies.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withPolicies

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

      public final ImmutableRole withServiceIdentities(Role.RoleServiceIdentity... elements)
      Copy the current immutable object with elements that replace the content of serviceIdentities.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withServiceIdentities

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

      public final ImmutableRole withNodeIdentities(Role.RoleNodeIdentity... elements)
      Copy the current immutable object with elements that replace the content of nodeIdentities.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withNodeIdentities

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

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

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

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableRole 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, id, description, policies, serviceIdentities, nodeIdentities, namespace.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableRole.Builder builder()
      Creates a builder for ImmutableRole.
       ImmutableRole.builder()
          .name(String) // required name
          .id(String) // optional id
          .description(String) // optional description
          .addPolicies|addAllPolicies(org.kiwiproject.consul.model.acl.Role.RolePolicyLink) // policies elements
          .addServiceIdentities|addAllServiceIdentities(org.kiwiproject.consul.model.acl.Role.RoleServiceIdentity) // serviceIdentities elements
          .addNodeIdentities|addAllNodeIdentities(org.kiwiproject.consul.model.acl.Role.RoleNodeIdentity) // nodeIdentities elements
          .namespace(String) // optional namespace
          .build();
       
      Returns:
      A new ImmutableRole builder