Package com.orbitz.consul.model.kv
Class ImmutableValue.Builder
- java.lang.Object
-
- com.orbitz.consul.model.kv.ImmutableValue.Builder
-
- Enclosing class:
- ImmutableValue
@NotThreadSafe public static final class ImmutableValue.Builder extends java.lang.ObjectBuilds instances of typeImmutableValue. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
Modifier and Type Method Description ImmutableValuebuild()Builds a newImmutableValue.ImmutableValue.BuildercreateIndex(long createIndex)Initializes the value for thecreateIndexattribute.ImmutableValue.Builderflags(long flags)Initializes the value for theflagsattribute.ImmutableValue.Builderfrom(Value instance)Fill a builder with attribute values from the providedValueinstance.ImmutableValue.Builderkey(java.lang.String key)Initializes the value for thekeyattribute.ImmutableValue.BuilderlockIndex(long lockIndex)Initializes the value for thelockIndexattribute.ImmutableValue.BuildermodifyIndex(long modifyIndex)Initializes the value for themodifyIndexattribute.ImmutableValue.Buildersession(java.lang.String session)Initializes the optional valuesessionto session.ImmutableValue.Buildersession(java.util.Optional<java.lang.String> session)Initializes the optional valuesessionto session.ImmutableValue.Buildervalue(java.lang.String value)Initializes the optional valuevalueto value.ImmutableValue.Buildervalue(java.util.Optional<java.lang.String> value)Initializes the optional valuevalueto value.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableValue.Builder from(Value instance)
Fill a builder with attribute values from the providedValueinstance. 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:
thisbuilder for use in a chained invocation
-
createIndex
@CanIgnoreReturnValue public final ImmutableValue.Builder createIndex(long createIndex)
Initializes the value for thecreateIndexattribute.- Parameters:
createIndex- The value for createIndex- Returns:
thisbuilder for use in a chained invocation
-
modifyIndex
@CanIgnoreReturnValue public final ImmutableValue.Builder modifyIndex(long modifyIndex)
Initializes the value for themodifyIndexattribute.- Parameters:
modifyIndex- The value for modifyIndex- Returns:
thisbuilder for use in a chained invocation
-
lockIndex
@CanIgnoreReturnValue public final ImmutableValue.Builder lockIndex(long lockIndex)
Initializes the value for thelockIndexattribute.- Parameters:
lockIndex- The value for lockIndex- Returns:
thisbuilder for use in a chained invocation
-
key
@CanIgnoreReturnValue public final ImmutableValue.Builder key(java.lang.String key)
Initializes the value for thekeyattribute.- Parameters:
key- The value for key- Returns:
thisbuilder for use in a chained invocation
-
flags
@CanIgnoreReturnValue public final ImmutableValue.Builder flags(long flags)
Initializes the value for theflagsattribute.- Parameters:
flags- The value for flags- Returns:
thisbuilder for use in a chained invocation
-
value
@CanIgnoreReturnValue public final ImmutableValue.Builder value(java.lang.String value)
Initializes the optional valuevalueto value.- Parameters:
value- The value for value- Returns:
thisbuilder for chained invocation
-
value
@CanIgnoreReturnValue public final ImmutableValue.Builder value(java.util.Optional<java.lang.String> value)
Initializes the optional valuevalueto value.- Parameters:
value- The value for value- Returns:
thisbuilder for use in a chained invocation
-
session
@CanIgnoreReturnValue public final ImmutableValue.Builder session(java.lang.String session)
Initializes the optional valuesessionto session.- Parameters:
session- The value for session- Returns:
thisbuilder for chained invocation
-
session
@CanIgnoreReturnValue public final ImmutableValue.Builder session(java.util.Optional<java.lang.String> session)
Initializes the optional valuesessionto session.- Parameters:
session- The value for session- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableValue build()
Builds a newImmutableValue.- Returns:
- An immutable instance of Value
- Throws:
java.lang.IllegalStateException- if any required attributes are missing
-
-