Class ImmutableValue.Builder

java.lang.Object
org.kiwiproject.consul.model.kv.ImmutableValue.Builder
Enclosing class:
ImmutableValue

public static final class ImmutableValue.Builder extends Object
Builds instances of type ImmutableValue. 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 Details

    • from

      @CanIgnoreReturnValue public final ImmutableValue.Builder from(Value instance)
      Fill a builder with attribute values from the provided Value instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • createIndex

      @CanIgnoreReturnValue public final ImmutableValue.Builder createIndex(long createIndex)
      Initializes the value for the createIndex attribute.
      Parameters:
      createIndex - The value for createIndex
      Returns:
      this builder for use in a chained invocation
    • modifyIndex

      @CanIgnoreReturnValue public final ImmutableValue.Builder modifyIndex(long modifyIndex)
      Initializes the value for the modifyIndex attribute.
      Parameters:
      modifyIndex - The value for modifyIndex
      Returns:
      this builder for use in a chained invocation
    • lockIndex

      @CanIgnoreReturnValue public final ImmutableValue.Builder lockIndex(long lockIndex)
      Initializes the value for the lockIndex attribute.
      Parameters:
      lockIndex - The value for lockIndex
      Returns:
      this builder for use in a chained invocation
    • key

      @CanIgnoreReturnValue public final ImmutableValue.Builder key(String key)
      Initializes the value for the key attribute.
      Parameters:
      key - The value for key
      Returns:
      this builder for use in a chained invocation
    • flags

      @CanIgnoreReturnValue public final ImmutableValue.Builder flags(long flags)
      Initializes the value for the flags attribute.
      Parameters:
      flags - The value for flags
      Returns:
      this builder for use in a chained invocation
    • value

      @CanIgnoreReturnValue public final ImmutableValue.Builder value(String value)
      Initializes the optional value value to value.
      Parameters:
      value - The value for value
      Returns:
      this builder for chained invocation
    • value

      @CanIgnoreReturnValue public final ImmutableValue.Builder value(Optional<String> value)
      Initializes the optional value value to value.
      Parameters:
      value - The value for value
      Returns:
      this builder for use in a chained invocation
    • session

      @CanIgnoreReturnValue public final ImmutableValue.Builder session(String session)
      Initializes the optional value session to session.
      Parameters:
      session - The value for session
      Returns:
      this builder for chained invocation
    • session

      @CanIgnoreReturnValue public final ImmutableValue.Builder session(Optional<String> session)
      Initializes the optional value session to session.
      Parameters:
      session - The value for session
      Returns:
      this builder for use in a chained invocation
    • build

      public ImmutableValue build()
      Builds a new ImmutableValue.
      Returns:
      An immutable instance of Value
      Throws:
      IllegalStateException - if any required attributes are missing