Class ImmutablePolicy


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

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

    • Method Summary

      Modifier and Type Method Description
      static ImmutablePolicy.Builder builder()
      Creates a builder for ImmutablePolicy.
      static ImmutablePolicy copyOf​(Policy instance)
      Creates an immutable copy of a Policy value.
      java.util.Optional<java.util.List<java.lang.String>> datacenters()  
      java.util.Optional<java.lang.String> description()  
      boolean equals​(java.lang.Object another)
      This instance is equal to all instances of ImmutablePolicy that have equal attribute values.
      int hashCode()
      Computes a hash code from attributes: id, description, name, rules, datacenters.
      java.util.Optional<java.lang.String> id()  
      java.lang.String name()  
      java.util.Optional<java.lang.String> rules()  
      java.lang.String toString()
      Prints the immutable value Policy with attribute values.
      ImmutablePolicy withDatacenters​(java.util.List<java.lang.String> value)
      Copy the current immutable object by setting a present value for the optional datacenters attribute.
      ImmutablePolicy withDatacenters​(java.util.Optional<? extends java.util.List<java.lang.String>> optional)
      Copy the current immutable object by setting an optional value for the datacenters attribute.
      ImmutablePolicy withDescription​(java.lang.String value)
      Copy the current immutable object by setting a present value for the optional description attribute.
      ImmutablePolicy withDescription​(java.util.Optional<java.lang.String> optional)
      Copy the current immutable object by setting an optional value for the description attribute.
      ImmutablePolicy withId​(java.lang.String value)
      Copy the current immutable object by setting a present value for the optional id attribute.
      ImmutablePolicy withId​(java.util.Optional<java.lang.String> optional)
      Copy the current immutable object by setting an optional value for the id attribute.
      ImmutablePolicy withName​(java.lang.String value)
      Copy the current immutable object by setting a value for the name attribute.
      ImmutablePolicy withRules​(java.lang.String value)
      Copy the current immutable object by setting a present value for the optional rules attribute.
      ImmutablePolicy withRules​(java.util.Optional<java.lang.String> optional)
      Copy the current immutable object by setting an optional value for the rules attribute.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • id

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

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

        public java.lang.String name()
        Specified by:
        name in class Policy
        Returns:
        The value of the name attribute
      • rules

        public java.util.Optional<java.lang.String> rules()
        Specified by:
        rules in class Policy
        Returns:
        The value of the rules attribute
      • datacenters

        public java.util.Optional<java.util.List<java.lang.String>> datacenters()
        Specified by:
        datacenters in class Policy
        Returns:
        The value of the datacenters attribute
      • withId

        public final ImmutablePolicy 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 ImmutablePolicy 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 ImmutablePolicy 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 ImmutablePolicy 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
      • withName

        public final ImmutablePolicy withName​(java.lang.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
      • withRules

        public final ImmutablePolicy withRules​(java.lang.String value)
        Copy the current immutable object by setting a present value for the optional rules attribute.
        Parameters:
        value - The value for rules
        Returns:
        A modified copy of this object
      • withRules

        public final ImmutablePolicy withRules​(java.util.Optional<java.lang.String> optional)
        Copy the current immutable object by setting an optional value for the rules 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 rules
        Returns:
        A modified copy of this object
      • withDatacenters

        public final ImmutablePolicy withDatacenters​(java.util.List<java.lang.String> value)
        Copy the current immutable object by setting a present value for the optional datacenters attribute.
        Parameters:
        value - The value for datacenters
        Returns:
        A modified copy of this object
      • withDatacenters

        public final ImmutablePolicy withDatacenters​(java.util.Optional<? extends java.util.List<java.lang.String>> optional)
        Copy the current immutable object by setting an optional value for the datacenters attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for datacenters
        Returns:
        A modified copy of this object
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object another)
        This instance is equal to all instances of ImmutablePolicy 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, name, rules, datacenters.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

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

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

        public static ImmutablePolicy.Builder builder()
        Creates a builder for ImmutablePolicy.
         ImmutablePolicy.builder()
            .id(String) // optional id
            .description(String) // optional description
            .name(String) // required name
            .rules(String) // optional rules
            .datacenters(List&lt;String&gt;) // optional datacenters
            .build();
         
        Returns:
        A new ImmutablePolicy builder