Interface PreferenceSerializer<S,T>
-
- Type Parameters:
S- the runtime type.T- the persistent type. must be one ofboolean,byte,short,char,int,long,float,doubleorString.
- All Known Implementing Classes:
EnumPreferenceSerializer
public interface PreferenceSerializer<S,T>An interface for converting between two types. SeePreference.serializer()for more information.- See Also:
Preference.serializer()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Sdeserialize(T value)Convert from persistent type to runtime type.Tserialize(S value)Convert from runtime type to persistent type.
-
-
-
Method Detail
-
serialize
T serialize(S value) throws PreferenceSerializationException
Convert from runtime type to persistent type. If the persistent type is a primitive (wrapper) the return value must not benull.- Parameters:
value- an object of the runtime type- Returns:
- the persistent type representation of the parameter
- Throws:
PreferenceSerializationException- if the object could not be serialized
-
deserialize
S deserialize(T value) throws PreferenceSerializationException
Convert from persistent type to runtime type. If the persistent type is a primitive (wrapper) the parameter is guaranteed to not benull- Parameters:
value- an object of the persistent type- Returns:
- the runtime type value of the parameter
- Throws:
PreferenceSerializationException- if the object could not be deserialized
-
-