I
- The type of immutable data manipulatorM
- The type of mutable data manipulatorpublic interface ImmutableDataManipulator<I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>> extends DataSerializable, ValueContainer<I>
ImmutableDataManipulator
is an immutable ValueContainer
such that once it is created, any BaseValue
s exist as
ImmutableValue
s. Any modification methods result in new instances of
the same typed ImmutableDataManipulator
.
As with DataManipulator
, it is always possible to translate back
and forth between mutable and immutable with asMutable()
and
DataManipulator.asImmutable()
.
Modifier and Type | Method and Description |
---|---|
M |
asMutable()
Gets a
DataManipulator copy of this
ImmutableDataManipulator such that all backed
ImmutableValue s are copied into their Value
counterparts. |
default I |
copy()
Creates a clone copy of this
ValueContainer as a new
ValueContainer such that all the BaseValue s are
safely duplicated to the new instance. |
default Optional<I> |
with(BaseValue<?> value)
Creates a new
ImmutableDataManipulator with the provided
BaseValue provided that the BaseValue is supported by
this ImmutableDataManipulator . |
default <E> Optional<I> |
with(Key<? extends BaseValue<E>> key,
E value)
Creates a new
ImmutableDataManipulator with the provided value
if the Key is supported by this ImmutableDataManipulator
without exception. |
getContentVersion, toContainer
default <E> Optional<I> with(Key<? extends BaseValue<E>> key, E value)
ImmutableDataManipulator
with the provided value
if the Key
is supported by this ImmutableDataManipulator
without exception.E
- The type of valuekey
- The key to usevalue
- The value to setdefault Optional<I> with(BaseValue<?> value)
ImmutableDataManipulator
with the provided
BaseValue
provided that the BaseValue
is supported by
this ImmutableDataManipulator
. A simple check can be called for
ValueContainer.supports(BaseValue)
prior to ensure
Optional.isPresent()
returns true
.value
- The value to setdefault I copy()
ValueContainer
ValueContainer
as a new
ValueContainer
such that all the BaseValue
s are
safely duplicated to the new instance.copy
in interface ValueContainer<I extends ImmutableDataManipulator<I,M>>
M asMutable()
DataManipulator
copy of this
ImmutableDataManipulator
such that all backed
ImmutableValue
s are copied into their Value
counterparts. Any changes to this ImmutableDataManipulator
will
NOT be reflected on the returned DataManipulator
and vice versa.ImmutableDataManipulator
's data copied into a
DataManipulator