Class ImmutableRole.Builder

java.lang.Object
org.kiwiproject.consul.model.acl.ImmutableRole.Builder
Enclosing class:
ImmutableRole

public static final class ImmutableRole.Builder extends Object
Builds instances of type ImmutableRole. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      @CanIgnoreReturnValue public final ImmutableRole.Builder from(Role instance)
      Fill a builder with attribute values from the provided Role instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • name

      @CanIgnoreReturnValue public final ImmutableRole.Builder name(String name)
      Initializes the value for the name attribute.
      Parameters:
      name - The value for name
      Returns:
      this builder for use in a chained invocation
    • id

      @CanIgnoreReturnValue public final ImmutableRole.Builder id(String id)
      Initializes the optional value id to id.
      Parameters:
      id - The value for id
      Returns:
      this builder for chained invocation
    • id

      @CanIgnoreReturnValue public final ImmutableRole.Builder id(Optional<String> id)
      Initializes the optional value id to id.
      Parameters:
      id - The value for id
      Returns:
      this builder for use in a chained invocation
    • description

      @CanIgnoreReturnValue public final ImmutableRole.Builder description(String description)
      Initializes the optional value description to description.
      Parameters:
      description - The value for description
      Returns:
      this builder for chained invocation
    • description

      @CanIgnoreReturnValue public final ImmutableRole.Builder description(Optional<String> description)
      Initializes the optional value description to description.
      Parameters:
      description - The value for description
      Returns:
      this builder for use in a chained invocation
    • addPolicies

      @CanIgnoreReturnValue public final ImmutableRole.Builder addPolicies(Role.RolePolicyLink element)
      Adds one element to policies list.
      Parameters:
      element - A policies element
      Returns:
      this builder for use in a chained invocation
    • addPolicies

      @CanIgnoreReturnValue public final ImmutableRole.Builder addPolicies(Role.RolePolicyLink... elements)
      Adds elements to policies list.
      Parameters:
      elements - An array of policies elements
      Returns:
      this builder for use in a chained invocation
    • policies

      @CanIgnoreReturnValue public final ImmutableRole.Builder policies(Iterable<? extends Role.RolePolicyLink> elements)
      Sets or replaces all elements for policies list.
      Parameters:
      elements - An iterable of policies elements
      Returns:
      this builder for use in a chained invocation
    • addAllPolicies

      @CanIgnoreReturnValue public final ImmutableRole.Builder addAllPolicies(Iterable<? extends Role.RolePolicyLink> elements)
      Adds elements to policies list.
      Parameters:
      elements - An iterable of policies elements
      Returns:
      this builder for use in a chained invocation
    • addServiceIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder addServiceIdentities(Role.RoleServiceIdentity element)
      Adds one element to serviceIdentities list.
      Parameters:
      element - A serviceIdentities element
      Returns:
      this builder for use in a chained invocation
    • addServiceIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder addServiceIdentities(Role.RoleServiceIdentity... elements)
      Adds elements to serviceIdentities list.
      Parameters:
      elements - An array of serviceIdentities elements
      Returns:
      this builder for use in a chained invocation
    • serviceIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder serviceIdentities(Iterable<? extends Role.RoleServiceIdentity> elements)
      Sets or replaces all elements for serviceIdentities list.
      Parameters:
      elements - An iterable of serviceIdentities elements
      Returns:
      this builder for use in a chained invocation
    • addAllServiceIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder addAllServiceIdentities(Iterable<? extends Role.RoleServiceIdentity> elements)
      Adds elements to serviceIdentities list.
      Parameters:
      elements - An iterable of serviceIdentities elements
      Returns:
      this builder for use in a chained invocation
    • addNodeIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder addNodeIdentities(Role.RoleNodeIdentity element)
      Adds one element to nodeIdentities list.
      Parameters:
      element - A nodeIdentities element
      Returns:
      this builder for use in a chained invocation
    • addNodeIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder addNodeIdentities(Role.RoleNodeIdentity... elements)
      Adds elements to nodeIdentities list.
      Parameters:
      elements - An array of nodeIdentities elements
      Returns:
      this builder for use in a chained invocation
    • nodeIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder nodeIdentities(Iterable<? extends Role.RoleNodeIdentity> elements)
      Sets or replaces all elements for nodeIdentities list.
      Parameters:
      elements - An iterable of nodeIdentities elements
      Returns:
      this builder for use in a chained invocation
    • addAllNodeIdentities

      @CanIgnoreReturnValue public final ImmutableRole.Builder addAllNodeIdentities(Iterable<? extends Role.RoleNodeIdentity> elements)
      Adds elements to nodeIdentities list.
      Parameters:
      elements - An iterable of nodeIdentities elements
      Returns:
      this builder for use in a chained invocation
    • namespace

      @CanIgnoreReturnValue public final ImmutableRole.Builder namespace(String namespace)
      Initializes the optional value namespace to namespace.
      Parameters:
      namespace - The value for namespace
      Returns:
      this builder for chained invocation
    • namespace

      @CanIgnoreReturnValue public final ImmutableRole.Builder namespace(Optional<String> namespace)
      Initializes the optional value namespace to namespace.
      Parameters:
      namespace - The value for namespace
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableRole build()
      Builds a new ImmutableRole.
      Returns:
      An immutable instance of Role
      Throws:
      IllegalStateException - if any required attributes are missing