T
- The type of valueI
- The type of immutable manipulatorM
- The type of mutable manipulatorpublic abstract class AbstractImmutableSingleData<T,I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>> extends AbstractImmutableData<I,M>
ImmutableDataManipulator
that
specifically deals with a single value.Modifier and Type | Field and Description |
---|---|
protected T |
defaultValue |
protected Key<? extends BaseValue<T>> |
usedKey |
protected T |
value |
Modifier | Constructor and Description |
---|---|
protected |
AbstractImmutableSingleData(Key<? extends Value<T>> usedKey,
T value) |
protected |
AbstractImmutableSingleData(Key<? extends Value<T>> usedKey,
T value,
T defaultValue) |
protected |
AbstractImmutableSingleData(T value,
Key<? extends BaseValue<T>> usedKey)
Deprecated.
Use
AbstractImmutableSingleData(Key, Object) instead. |
Modifier and Type | Method and Description |
---|---|
abstract M |
asMutable()
Gets a
DataManipulator copy of this
ImmutableDataManipulator such that all backed
ImmutableValue s are copied into their Value
counterparts. |
boolean |
equals(Object obj) |
<E> Optional<E> |
get(Key<? extends BaseValue<E>> key)
|
Set<Key<?>> |
getKeys()
Gets all applicable
Key s for this ValueContainer . |
protected T |
getValue() |
protected abstract ImmutableValue<?> |
getValueGetter() |
int |
hashCode() |
protected void |
registerGetters() |
boolean |
supports(Key<?> key)
Checks if the given
Key is supported by this
ValueContainer . |
copy, fillContainer, getValue, getValues, registerFieldGetter, registerKeyValue, toContainer
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
with, with
getContentVersion
getOrElse, getOrNull, require, supports
@Deprecated protected AbstractImmutableSingleData(T value, Key<? extends BaseValue<T>> usedKey)
AbstractImmutableSingleData(Key, Object)
instead.protected AbstractImmutableSingleData(Key<? extends Value<T>> usedKey, T value)
protected abstract ImmutableValue<?> getValueGetter()
protected final T getValue()
public abstract M asMutable()
ImmutableDataManipulator
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
protected final void registerGetters()
registerGetters
in class AbstractImmutableData<I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>>
public <E> Optional<E> get(Key<? extends BaseValue<E>> key)
ValueContainer
BaseValue
linked to the provided Key
. If the Key
is not
supported, Optional.empty()
is returned. It is important
to check for support of a Key
by either calling
ValueContainer.supports(BaseValue)
or ValueContainer.supports(Key)
.get
in interface ValueContainer<I extends ImmutableDataManipulator<I,M>>
get
in class AbstractImmutableData<I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>>
E
- The type of valuekey
- The key linking thepublic boolean supports(Key<?> key)
ValueContainer
Key
is supported by this
ValueContainer
.supports
in interface ValueContainer<I extends ImmutableDataManipulator<I,M>>
supports
in class AbstractImmutableData<I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>>
key
- The key to checkpublic Set<Key<?>> getKeys()
ValueContainer
Key
s for this ValueContainer
.
Changes can not be made to the set to alter the ValueContainer
,
nor can the BaseValue
s be changed with the provided
ImmutableSet
.getKeys
in interface ValueContainer<I extends ImmutableDataManipulator<I,M>>
getKeys
in class AbstractImmutableData<I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>>
Key
spublic int hashCode()
hashCode
in class AbstractImmutableData<I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>>
public boolean equals(Object obj)
equals
in class AbstractImmutableData<I extends ImmutableDataManipulator<I,M>,M extends DataManipulator<M,I>>