T - The type of data serializable this builder can buildpublic interface DataBuilder<T extends DataSerializable> extends ResettableBuilder<T,DataBuilder<T>>
DataContainer and create a
new instance of a DataSerializable. The builder should be a
singleton and may not exist for every data serializable.
It is HIGHLY recommended to extend
AbstractDataBuilder as it implements content updating
| Modifier and Type | Method and Description |
|---|---|
Optional<T> |
build(DataView container)
Attempts to build the provided
DataSerializable from the given
DataView. |
default DataBuilder<T> |
from(T value)
Resets this builder to the values of the given built object.
|
default DataBuilder<T> |
reset()
Resets this builder to a "default" state such that there is no
remaining data to set.
|
Optional<T> build(DataView container) throws InvalidDataException
DataSerializable from the given
DataView. If the DataView is invalid or
missing necessary information to complete building the
DataSerializable, Optional.empty() may be returned.container - The container containing all necessary dataDataSerializable, if successfulInvalidDataException - In the event that the builder is unable to
properly construct the data serializable from the data viewdefault DataBuilder<T> reset()
ResettableBuilderreset in interface ResettableBuilder<T extends DataSerializable,DataBuilder<T extends DataSerializable>>default DataBuilder<T> from(T value)
ResettableBuilderfrom in interface ResettableBuilder<T extends DataSerializable,DataBuilder<T extends DataSerializable>>value - The built object