@NotThreadSafe public static final class ImmutableValue.Builder extends Object
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.
| Modifier and Type | Method and Description |
|---|---|
ImmutableValue |
build()
Builds a new
ImmutableValue. |
ImmutableValue.Builder |
createIndex(long createIndex)
Initializes the value for the
createIndex attribute. |
ImmutableValue.Builder |
flags(long flags)
Initializes the value for the
flags attribute. |
ImmutableValue.Builder |
from(Value instance)
Fill a builder with attribute values from the provided
Value instance. |
ImmutableValue.Builder |
key(String key)
Initializes the value for the
key attribute. |
ImmutableValue.Builder |
lockIndex(long lockIndex)
Initializes the value for the
lockIndex attribute. |
ImmutableValue.Builder |
modifyIndex(long modifyIndex)
Initializes the value for the
modifyIndex attribute. |
ImmutableValue.Builder |
session(Optional<String> session)
Initializes the optional value
session to session. |
ImmutableValue.Builder |
session(String session)
Initializes the optional value
session to session. |
ImmutableValue.Builder |
value(Optional<String> value)
Initializes the optional value
value to value. |
ImmutableValue.Builder |
value(String value)
Initializes the optional value
value to value. |
@CanIgnoreReturnValue public final ImmutableValue.Builder from(Value instance)
Value instance.
Regular attribute values will be replaced with those from the given instance.
Absent optional values will not replace present values.instance - The instance from which to copy valuesthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder createIndex(long createIndex)
createIndex attribute.createIndex - The value for createIndexthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder modifyIndex(long modifyIndex)
modifyIndex attribute.modifyIndex - The value for modifyIndexthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder lockIndex(long lockIndex)
lockIndex attribute.lockIndex - The value for lockIndexthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder key(String key)
key attribute.key - The value for keythis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder flags(long flags)
flags attribute.flags - The value for flagsthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder value(String value)
value to value.value - The value for valuethis builder for chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder value(Optional<String> value)
value to value.value - The value for valuethis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder session(String session)
session to session.session - The value for sessionthis builder for chained invocation@CanIgnoreReturnValue public final ImmutableValue.Builder session(Optional<String> session)
session to session.session - The value for sessionthis builder for use in a chained invocationpublic ImmutableValue build()
ImmutableValue.IllegalStateException - if any required attributes are missingCopyright © 2019. All rights reserved.