T
- The type of data serializable this builder can buildpublic interface DataBuilder<T extends DataSerializable>
DataContainer
and create a
new instance of a DataSerializable
. The builder should be a
singleton and may not exist for every data serializable.Modifier and Type | Method and Description |
---|---|
Optional<T> |
build(DataView container)
Attempts to build the provided
DataSerializable from the given
DataView . |
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 view