T - The type of object that this translator can handle@CatalogedBy(value=DataTranslators.class) public interface DataTranslator<T> extends CatalogType
Object that is not a DataSerializable. Natively,
DataView will attempt to locate a DataTranslator
during DataView.set(DataQuery, Object).| Modifier and Type | Method and Description |
|---|---|
default DataView |
addTo(T obj,
DataView dataView)
Serializes the
T object and applies the provided
data to the provided DataView instead of creating
a new DataContainer, reducing nested information. |
TypeToken<T> |
getToken()
Gets the
TypeToken of this translator. |
T |
translate(DataView view)
Attempts to translate the
T object from the provided
DataView. |
DataContainer |
translate(T obj)
Serializes the provided object to a
DataContainer. |
getId, getNameTypeToken<T> getToken()
TypeToken of this translator.TypeTokenT translate(DataView view) throws InvalidDataException
T object from the provided
DataView.view - The data view to translate the object fromInvalidDataException - If the dataview contained invalid dataDataContainer translate(T obj) throws InvalidDataException
DataContainer.obj - The object to translateInvalidDataException - If the desired object is not supported
for any reasondefault DataView addTo(T obj, DataView dataView)
T object and applies the provided
data to the provided DataView instead of creating
a new DataContainer, reducing nested information.obj - The object to serializedataView - The data view to serialize to