Class ImmutableServiceIdentity.Builder

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

public static final class ImmutableServiceIdentity.Builder extends Object
Builds instances of type ImmutableServiceIdentity. 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 ImmutableServiceIdentity.Builder from(Token.ServiceIdentity instance)
      Fill a builder with attribute values from the provided ServiceIdentity 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 ImmutableServiceIdentity.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
    • addDatacenters

      @CanIgnoreReturnValue public final ImmutableServiceIdentity.Builder addDatacenters(String element)
      Adds one element to datacenters list.
      Parameters:
      element - A datacenters element
      Returns:
      this builder for use in a chained invocation
    • addDatacenters

      @CanIgnoreReturnValue public final ImmutableServiceIdentity.Builder addDatacenters(String... elements)
      Adds elements to datacenters list.
      Parameters:
      elements - An array of datacenters elements
      Returns:
      this builder for use in a chained invocation
    • datacenters

      @CanIgnoreReturnValue public final ImmutableServiceIdentity.Builder datacenters(Iterable<String> elements)
      Sets or replaces all elements for datacenters list.
      Parameters:
      elements - An iterable of datacenters elements
      Returns:
      this builder for use in a chained invocation
    • addAllDatacenters

      @CanIgnoreReturnValue public final ImmutableServiceIdentity.Builder addAllDatacenters(Iterable<String> elements)
      Adds elements to datacenters list.
      Parameters:
      elements - An iterable of datacenters elements
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableServiceIdentity build()
      Returns:
      An immutable instance of ServiceIdentity
      Throws:
      IllegalStateException - if any required attributes are missing