public interface SerializationService
DataBuilder
s and sometimes the
deserialization of various DataSerializable
s.Modifier and Type | Method and Description |
---|---|
<T extends DataSerializable> |
deserialize(Class<T> clazz,
DataView dataView)
Attempts to deserialize an instance of the
DataSerializable from
the provided DataView . |
<T extends DataSerializable> |
getBuilder(Class<T> clazz)
Attempts to retrieve the
DataBuilder for the desired
DataSerializable class. |
<T extends DataSerializable> |
registerBuilder(Class<T> clazz,
DataBuilder<T> builder)
Registers a
DataBuilder that will dynamically build
the given DataSerializable from a DataContainer . |
<T extends DataSerializable> void registerBuilder(Class<T> clazz, DataBuilder<T> builder)
DataBuilder
that will dynamically build
the given DataSerializable
from a DataContainer
.
Builders may not always exist for a given DataSerializable
,
nor is it guaranteed that a provided builder will function with all
DataContainer
s.
T
- The type of data serializableclazz
- The class of the DataSerializable
builder
- The builder that can build the data serializable<T extends DataSerializable> Optional<DataBuilder<T>> getBuilder(Class<T> clazz)
DataBuilder
for the desired
DataSerializable
class.
Builders may not always exist for a given DataSerializable
,
nor is it guaranteed that a provided builder will function with all
DataContainer
s.
T
- The type of data serializableclazz
- The class of the data serializable<T extends DataSerializable> Optional<T> deserialize(Class<T> clazz, DataView dataView)
DataSerializable
from
the provided DataView
. If there is no DataBuilder
registered for the provided DataSerializable
, then
Optional.empty()
may be returned.T
- The type of data serializableclazz
- The class of the data serializabledataView
- The data view containing raw data