@NotThreadSafe public static final class ImmutableContext.Builder extends Object
ImmutableContext.
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 |
|---|---|
ImmutableContext |
build()
Builds a new
ImmutableContext. |
ImmutableContext.Builder |
from(Context instance)
Fill a builder with attribute values from the provided
Context instance. |
ImmutableContext.Builder |
putAllValidationErrorMap(Map<? extends Value<?>,? extends ValidationError> entries)
Put all mappings from the specified map as entries to
validationErrorMap map. |
ImmutableContext.Builder |
putValidationErrorMap(Map.Entry<? extends Value<?>,? extends ValidationError> entry)
Put one entry to the
validationErrorMap map. |
ImmutableContext.Builder |
putValidationErrorMap(Value<?> key,
ValidationError value)
Put one entry to the
validationErrorMap map. |
ImmutableContext.Builder |
unvalidated(ValueContainer unvalidated)
Initializes the value for the
unvalidated attribute. |
ImmutableContext.Builder |
validatedValues(ValueContainer validatedValues)
Initializes the value for the
validatedValues attribute. |
ImmutableContext.Builder |
validationErrorMap(Map<? extends Value<?>,? extends ValidationError> entries)
Sets or replaces all mappings from the specified map as entries for the
validationErrorMap map. |
@CanIgnoreReturnValue public final ImmutableContext.Builder from(Context instance)
Context instance.
Regular attribute values will be replaced with those from the given instance.
Absent optional values will not replace present values.
Collection elements and entries will be added, not replaced.instance - The instance from which to copy valuesthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableContext.Builder unvalidated(ValueContainer unvalidated)
unvalidated attribute.
If not set, this attribute will have a default value as returned by the initializer of unvalidated.
unvalidated - The value for unvalidatedthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableContext.Builder validatedValues(ValueContainer validatedValues)
validatedValues attribute.
If not set, this attribute will have a default value as returned by the initializer of validatedValues.
validatedValues - The value for validatedValuesthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableContext.Builder putValidationErrorMap(Value<?> key, ValidationError value)
validationErrorMap map.key - The key in the validationErrorMap mapvalue - The associated value in the validationErrorMap mapthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableContext.Builder putValidationErrorMap(Map.Entry<? extends Value<?>,? extends ValidationError> entry)
validationErrorMap map. Nulls are not permittedentry - The key and value entrythis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableContext.Builder validationErrorMap(Map<? extends Value<?>,? extends ValidationError> entries)
validationErrorMap map. Nulls are not permittedentries - The entries that will be added to the validationErrorMap mapthis builder for use in a chained invocation@CanIgnoreReturnValue public final ImmutableContext.Builder putAllValidationErrorMap(Map<? extends Value<?>,? extends ValidationError> entries)
validationErrorMap map. Nulls are not permittedentries - The entries that will be added to the validationErrorMap mapthis builder for use in a chained invocationpublic ImmutableContext build()
ImmutableContext.IllegalStateException - if any required attributes are missingCopyright © 2023. All rights reserved.