Class ImmutableToken


  • @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutableToken
    extends Token
    Immutable implementation of Token.

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

    • Method Detail

      • id

        public java.util.Optional<java.lang.String> id()
        Specified by:
        id in class Token
        Returns:
        The value of the id attribute
      • description

        public java.util.Optional<java.lang.String> description()
        Specified by:
        description in class Token
        Returns:
        The value of the description attribute
      • local

        public boolean local()
        Specified by:
        local in class Token
        Returns:
        The value of the local attribute
      • policies

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

        public final ImmutableToken withId​(java.lang.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 ImmutableToken withId​(java.util.Optional<java.lang.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 ImmutableToken withDescription​(java.lang.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 ImmutableToken withDescription​(java.util.Optional<java.lang.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
      • withLocal

        public final ImmutableToken withLocal​(boolean value)
        Copy the current immutable object by setting a value for the local attribute. A value equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for local
        Returns:
        A modified copy of the this object
      • withPolicies

        public final ImmutableToken withPolicies​(Token.PolicyLink... 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 ImmutableToken withPolicies​(java.lang.Iterable<? extends Token.PolicyLink> 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
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object another)
        This instance is equal to all instances of ImmutableToken that have equal attribute values.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: id, description, local, policies.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

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

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

        public static ImmutableToken.Builder builder()
        Creates a builder for ImmutableToken.
         ImmutableToken.builder()
            .id(String) // optional id
            .description(String) // optional description
            .local(boolean) // required local
            .addPolicies|addAllPolicies(com.orbitz.consul.model.acl.Token.PolicyLink) // policies elements
            .build();
         
        Returns:
        A new ImmutableToken builder