M - The mutable data manipulator typeI - The immutable data manipulator typepublic abstract class AbstractData<M extends DataManipulator<M,I>,I extends ImmutableDataManipulator<I,M>> extends Object implements DataManipulator<M,I>
DataManipulator. This
 provides all the otherwise "redundant" code dealing with various methods
 such as get(Key) or supports(Key) etc. The root of this
 implementation relies on a pseudo registration of
 registerFieldGetter(Key, Supplier),
 registerFieldSetter(Key, Consumer),
 and registerKeyValue(Key, Supplier) of which supply and consume
 values otherwise accessible by fields.| Modifier | Constructor and Description | 
|---|---|
| protected  | AbstractData() | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | equals(Object obj) | 
| protected DataContainer | fillContainer(DataContainer dataContainer)Implement this method to add the data to be persisted. | 
| <E> Optional<E> | get(Key<? extends BaseValue<E>> key) | 
| Set<Key<?>> | getKeys()Gets all applicable  Keys for thisValueContainer. | 
| <E,V extends BaseValue<E>> | getValue(Key<V> key) | 
| Set<ImmutableValue<?>> | getValues()Gets all applicable  BaseValues associated with thisValueContainer. | 
| int | hashCode() | 
| protected void | registerFieldGetter(Key<?> key,
                   Supplier<?> function)Simple registration method for the keys to field getter methods. | 
| protected <E> void | registerFieldSetter(Key<? extends BaseValue<E>> key,
                   Consumer<E> function)Simple registration method for the keys to field setter methods. | 
| protected abstract void | registerGettersAndSetters()A required registration method for registering the various fields and
 value getters. | 
| protected void | registerKeyValue(Key<?> key,
                Supplier<Value<?>> function)Simple registration method for the keys to value return methods. | 
| <E> M | set(Key<? extends BaseValue<E>> key,
   E value)Sets the supported  Key's value such that the value is set on
 thisDataManipulatorwithout having to directly set theValueandDataManipulator.set(BaseValue)afterwards. | 
| boolean | supports(Key<?> key)Checks if the given  Keyis supported by thisValueContainer. | 
| DataContainer | toContainer()Serializes this object into a comprehensible  DataContainer. | 
| <E> M | transform(Key<? extends BaseValue<E>> key,
         Function<E,E> function)Applies a transformation on the provided value if available. | 
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitasImmutable, copy, fill, fill, from, set, set, setgetContentVersiongetOrElse, getOrNull, require, supportsprotected final void registerKeyValue(Key<?> key, Supplier<Value<?>> function)
Note that this is still usable with Java 8 method references.
 Referencing this::getfoo() is recommended.
key - The key for the value return typefunction - The function for getting the valueprotected final void registerFieldGetter(Key<?> key, Supplier<?> function)
Note that this is still usable with Java 8 method references.
 Referencing this::getfoo() is recommended.
key - The key for the value return typefunction - The function for getting the fieldprotected final <E> void registerFieldSetter(Key<? extends BaseValue<E>> key, Consumer<E> function)
Note that this is still usable with Java 8 method references.
 Referencing this::setFoo(something) is recommended.
key - The key for the value return typefunction - The function for setting the fieldprotected abstract void registerGettersAndSetters()
public <E> M set(Key<? extends BaseValue<E>> key, E value)
DataManipulatorKey's value such that the value is set on
 this DataManipulator without having to directly set the
 Value and DataManipulator.set(BaseValue) afterwards. The requirement
 for this to succeed is that the Key must be checked that it is
 supported via ValueContainer.supports(BaseValue) or ValueContainer.supports(Key)
 otherwise an IllegalArgumentException may be thrown. For
 fluency, after setting, this DataManipulator is returned.set in interface DataManipulator<M extends DataManipulator<M,I>,I extends ImmutableDataManipulator<I,M>>E - The type of valuekey - The key of the value to setvalue - The actual value to setpublic <E> M transform(Key<? extends BaseValue<E>> key, Function<E,E> function)
DataManipulatorCompositeValueStore.transform(Key, Function).transform in interface DataManipulator<M extends DataManipulator<M,I>,I extends ImmutableDataManipulator<I,M>>E - The type of elementkey - The key to usefunction - The function to applypublic <E> Optional<E> get(Key<? extends BaseValue<E>> key)
ValueContainerBaseValue
 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<M extends DataManipulator<M,I>>E - The type of valuekey - The key linking thepublic <E,V extends BaseValue<E>> Optional<V> getValue(Key<V> key)
ValueContainergetValue in interface ValueContainer<M extends DataManipulator<M,I>>E - The type of the return typeV - The type of valuekey - The key linked to the BaseValuepublic boolean supports(Key<?> key)
ValueContainerKey is supported by this
 ValueContainer.supports in interface ValueContainer<M extends DataManipulator<M,I>>key - The key to checkpublic Set<Key<?>> getKeys()
ValueContainerKeys for this ValueContainer.
 Changes can not be made to the set to alter the ValueContainer,
 nor can the BaseValues be changed with the provided
 ImmutableSet.getKeys in interface ValueContainer<M extends DataManipulator<M,I>>Keyspublic Set<ImmutableValue<?>> getValues()
ValueContainerBaseValues associated with this
 ValueContainer. As the data backed by the values are copied,
 any modifications to the BaseValues will not be reflected onto
 this ValueContainer.getValues in interface ValueContainer<M extends DataManipulator<M,I>>public DataContainer toContainer()
DataSerializableDataContainer.toContainer in interface DataSerializableprotected DataContainer fillContainer(DataContainer dataContainer)
dataContainer - The data container