Class ImmutablePutOptions

java.lang.Object
org.kiwiproject.consul.option.PutOptions
org.kiwiproject.consul.option.ImmutablePutOptions
All Implemented Interfaces:
ParamAdder

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

Use the builder to create immutable instances: ImmutablePutOptions.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
    • getCas

      public Optional<Long> getCas()
      Specified by:
      getCas in class PutOptions
      Returns:
      The value of the cas attribute
    • getAcquire

      public Optional<String> getAcquire()
      Specified by:
      getAcquire in class PutOptions
      Returns:
      The value of the acquire attribute
    • getRelease

      public Optional<String> getRelease()
      Specified by:
      getRelease in class PutOptions
      Returns:
      The value of the release attribute
    • getDc

      public Optional<String> getDc()
      Specified by:
      getDc in class PutOptions
      Returns:
      The value of the dc attribute
    • getToken

      public Optional<String> getToken()
      Specified by:
      getToken in class PutOptions
      Returns:
      The value of the token attribute
    • withToQueryParameters

      public final ImmutablePutOptions 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 ImmutablePutOptions 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 ImmutablePutOptions 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
    • withCas

      public final ImmutablePutOptions withCas(long value)
      Copy the current immutable object by setting a present value for the optional cas attribute.
      Parameters:
      value - The value for cas
      Returns:
      A modified copy of this object
    • withCas

      public final ImmutablePutOptions withCas(Optional<Long> optional)
      Copy the current immutable object by setting an optional value for the cas 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 cas
      Returns:
      A modified copy of this object
    • withAcquire

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

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

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

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

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

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

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

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

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutablePutOptions 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, cas, acquire, release, dc, token.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutablePutOptions.Builder builder()
      Creates a builder for ImmutablePutOptions.
       ImmutablePutOptions.builder()
          .addToQueryParameters|addAllToQueryParameters(String) // toQueryParameters elements
          .putToHeaders|putAllToHeaders(String => String) // toHeaders mappings
          .cas(Long) // optional cas
          .acquire(String) // optional acquire
          .release(String) // optional release
          .dc(String) // optional dc
          .token(String) // optional token
          .build();
       
      Returns:
      A new ImmutablePutOptions builder