Class ImmutableToken.Builder

  • Enclosing class:
    ImmutableToken

    @NotThreadSafe
    public static final class ImmutableToken.Builder
    extends java.lang.Object
    Builds instances of type ImmutableToken. 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 Detail

      • from

        @CanIgnoreReturnValue
        public final ImmutableToken.Builder from​(Token instance)
        Fill a builder with attribute values from the provided Token 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
      • id

        @CanIgnoreReturnValue
        public final ImmutableToken.Builder id​(java.lang.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 ImmutableToken.Builder id​(java.util.Optional<java.lang.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 ImmutableToken.Builder description​(java.lang.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 ImmutableToken.Builder description​(java.util.Optional<java.lang.String> description)
        Initializes the optional value description to description.
        Parameters:
        description - The value for description
        Returns:
        this builder for use in a chained invocation
      • local

        @CanIgnoreReturnValue
        public final ImmutableToken.Builder local​(boolean local)
        Initializes the value for the local attribute.
        Parameters:
        local - The value for local
        Returns:
        this builder for use in a chained invocation
      • addPolicies

        @CanIgnoreReturnValue
        public final ImmutableToken.Builder addPolicies​(Token.PolicyLink 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 ImmutableToken.Builder addPolicies​(Token.PolicyLink... 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 ImmutableToken.Builder policies​(java.lang.Iterable<? extends Token.PolicyLink> 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 ImmutableToken.Builder addAllPolicies​(java.lang.Iterable<? extends Token.PolicyLink> elements)
        Adds elements to policies list.
        Parameters:
        elements - An iterable of policies elements
        Returns:
        this builder for use in a chained invocation
      • build

        public ImmutableToken build()
        Builds a new ImmutableToken.
        Returns:
        An immutable instance of Token
        Throws:
        java.lang.IllegalStateException - if any required attributes are missing