Class ImmutableRoleOptions

java.lang.Object
org.kiwiproject.consul.option.RoleOptions
org.kiwiproject.consul.option.ImmutableRoleOptions
All Implemented Interfaces:
ParamAdder

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableRoleOptions extends RoleOptions
Immutable implementation of RoleOptions.

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

  • Method Details

    • toQueryParameters

      public com.google.common.collect.ImmutableList<String> toQueryParameters()
      Returns:
      The value of the toQueryParameters attribute
    • toHeaders

      public com.google.common.collect.ImmutableMap<String,String> toHeaders()
      Returns:
      The value of the toHeaders attribute
    • getPolicy

      public Optional<String> getPolicy()
      Specified by:
      getPolicy in class RoleOptions
      Returns:
      The value of the policy attribute
    • getNamespace

      public Optional<String> getNamespace()
      Specified by:
      getNamespace in class RoleOptions
      Returns:
      The value of the namespace attribute
    • withToQueryParameters

      public final ImmutableRoleOptions withToQueryParameters(String... elements)
      Copy the current immutable object with elements that replace the content of toQueryParameters.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withToQueryParameters

      public final ImmutableRoleOptions withToQueryParameters(Iterable<String> elements)
      Copy the current immutable object with elements that replace the content of toQueryParameters. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of toQueryParameters elements to set
      Returns:
      A modified copy of this object
    • withToHeaders

      public final ImmutableRoleOptions withToHeaders(Map<String,? extends String> entries)
      Copy the current immutable object by replacing the toHeaders map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the toHeaders map
      Returns:
      A modified copy of this object
    • withPolicy

      public final ImmutableRoleOptions withPolicy(String value)
      Copy the current immutable object by setting a present value for the optional policy attribute.
      Parameters:
      value - The value for policy
      Returns:
      A modified copy of this object
    • withPolicy

      public final ImmutableRoleOptions withPolicy(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the policy 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 policy
      Returns:
      A modified copy of this object
    • withNamespace

      public final ImmutableRoleOptions withNamespace(String value)
      Copy the current immutable object by setting a present value for the optional namespace attribute.
      Parameters:
      value - The value for namespace
      Returns:
      A modified copy of this object
    • withNamespace

      public final ImmutableRoleOptions withNamespace(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the namespace 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 namespace
      Returns:
      A modified copy of this object
    • equals

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

      public int hashCode()
      Computes a hash code from attributes: toQueryParameters, toHeaders, policy, namespace.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableRoleOptions.Builder builder()
      Creates a builder for ImmutableRoleOptions.
       ImmutableRoleOptions.builder()
          .addToQueryParameters|addAllToQueryParameters(String) // toQueryParameters elements
          .putToHeaders|putAllToHeaders(String => String) // toHeaders mappings
          .policy(String) // optional policy
          .namespace(String) // optional namespace
          .build();
       
      Returns:
      A new ImmutableRoleOptions builder