Package me.hsgamer.hscore.serializer
Class DataConverter<F,T,I,O>
java.lang.Object
me.hsgamer.hscore.serializer.DataConverter<F,T,I,O>
- Type Parameters:
F- the type of the raw objectT- the type of the final objectI- the type of the input of the serializerO- the type of the output of the serializer
The data converter, which converts the raw object to the final object and vice versa
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract FconvertFrom(I data, String type, T to) Convert the dataprotected abstract TConvert the dataprotected abstract Serializer<I, O> Create the serializerdeserialize(F from) Deserialize the raw objectprotected abstract IGet the input from the raw objectprotected abstract OGet the output from the final objectSerializer<I, O> Get the serializerprotected abstract StringGet the type of the raw objectSerialize the final object
-
Constructor Details
-
DataConverter
protected DataConverter()Create a new data converter
-
-
Method Details
-
createSerializer
Create the serializer- Returns:
- the serializer
-
convertTo
Convert the data- Parameters:
data- the datafrom- the object to convert from- Returns:
- the final object
-
convertFrom
Convert the data- Parameters:
data- the datatype- the type of the datato- the final object- Returns:
- the raw object
-
getOutput
Get the output from the final object- Parameters:
to- the final object- Returns:
- the output
-
getInput
Get the input from the raw object- Parameters:
from- the raw object- Returns:
- the input
-
getType
Get the type of the raw object- Parameters:
from- the raw object- Returns:
- the type
-
deserialize
Deserialize the raw object- Parameters:
from- the raw object- Returns:
- the final object
-
serialize
Serialize the final object- Parameters:
to- the final object- Returns:
- the raw object
-
getSerializer
Get the serializer- Returns:
- the serializer
-