Class EnumPreferenceSerializer<T extends java.lang.Enum<T>>
- java.lang.Object
-
- eu.jonahbauer.android.preference.annotations.serializer.EnumPreferenceSerializer<T>
-
- All Implemented Interfaces:
PreferenceSerializer<T,java.lang.String>
public final class EnumPreferenceSerializer<T extends java.lang.Enum<T>> extends java.lang.Object implements PreferenceSerializer<T,java.lang.String>
-
-
Constructor Summary
Constructors Constructor Description EnumPreferenceSerializer(java.lang.Class<T> clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tdeserialize(java.lang.String value)Convert from persistent type to runtime type.java.lang.Stringserialize(T value)Convert from runtime type to persistent type.
-
-
-
Constructor Detail
-
EnumPreferenceSerializer
public EnumPreferenceSerializer(java.lang.Class<T> clazz)
-
-
Method Detail
-
serialize
public java.lang.String serialize(T value)
Description copied from interface:PreferenceSerializerConvert from runtime type to persistent type. If the persistent type is a primitive (wrapper) the return value must not benull.- Specified by:
serializein interfacePreferenceSerializer<T extends java.lang.Enum<T>,java.lang.String>- Parameters:
value- an object of the runtime type- Returns:
- the persistent type representation of the parameter
-
deserialize
public T deserialize(java.lang.String value)
Description copied from interface:PreferenceSerializerConvert from persistent type to runtime type. If the persistent type is a primitive (wrapper) the parameter is guaranteed to not benull- Specified by:
deserializein interfacePreferenceSerializer<T extends java.lang.Enum<T>,java.lang.String>- Parameters:
value- an object of the persistent type- Returns:
- the runtime type value of the parameter
-
-