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
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract F
convertFrom
(I data, String type, T to) Convert the dataprotected abstract T
Convert the dataprotected abstract Serializer<I,
O> Create the serializerdeserialize
(F from) Deserialize the raw objectprotected abstract I
Get the input from the raw objectprotected abstract O
Get the output from the final objectSerializer<I,
O> Get the serializerprotected abstract String
Get 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
-