Class EnumConverter<E extends Enum>
java.lang.Object
org.nuiton.converter.EnumConverter<E>
- All Implemented Interfaces:
org.apache.commons.beanutils.Converter, NuitonConverter<E>
To convert
Enum type-safe (exact type is enumType
from and to String.
It is possible also to convert the enum object from his ordinal using method convertFromOrdinal(Class, Object).
you can also define a default value while trying to convert null value.
To register a new such converter use methods ConverterUtil.registerEnumConverter(Class),
or ConverterUtil.registerEnumConverter(Class, Object) .
- Since:
- 1.0
- Author:
- Tony Chemit - chemit@codelutin.com
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ObjectDefault value to use if try to convertnullvalue and flaguseDefaultis on.Enum type-safe.protected booleanflag to use or not default value. -
Constructor Summary
ConstructorsConstructorDescriptionEnumConverter(Class<E> enumType) EnumConverter(Class<E> enumType, Object defaultValue) -
Method Summary
-
Field Details
-
defaultValue
Default value to use if try to convertnullvalue and flaguseDefaultis on. -
useDefault
protected boolean useDefaultflag to use or not default value. -
enumType
-
-
Constructor Details
-
EnumConverter
-
EnumConverter
-
-
Method Details
-
convert
-
getType
-
isEnabled
-
convertFromOrdinal
-
valueOf
-
allOf
-