Package net.sf.jkniv.whinstone.types
Class EnumOrdinalType
- java.lang.Object
-
- net.sf.jkniv.whinstone.types.EnumOrdinalType
-
- All Implemented Interfaces:
Convertible<Enum<?>,Integer>
public class EnumOrdinalType extends Object implements Convertible<Enum<?>,Integer>
A Enumeration converter value. For save then name values of Enumeration.@Converter(converter = TimeUnit.class, isEnum = EnumType.STRING)
For save then ordinal value of Enumeration.@Converter(converter = TimeUnit.class, isEnum = EnumType.ORDINAL)
If any value is used forisEnumtheEnumType.STRINGis used per default.@Converter(converter = TimeUnit.class)
- Since:
- 0.6.0
- Author:
- Alisson Gomes
-
-
Constructor Summary
Constructors Constructor Description EnumOrdinalType(Class<?> enumType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColumnTypegetColumnType()ClassgetType()Enum<?>toAttribute(Integer jdbc)Convert the jdbc value to attribute format or typeIntegertoJdbc(Enum<?> attribute)Convert attribute to jdbc format or typeStringtoString()
-
-
-
Constructor Detail
-
EnumOrdinalType
public EnumOrdinalType(Class<?> enumType)
-
-
Method Detail
-
toJdbc
public Integer toJdbc(Enum<?> attribute)
Description copied from interface:ConvertibleConvert attribute to jdbc format or type- Specified by:
toJdbcin interfaceConvertible<Enum<?>,Integer>- Parameters:
attribute- the value of to be converted- Returns:
- the value to be stored for jdbc driver
-
toAttribute
public Enum<?> toAttribute(Integer jdbc)
Description copied from interface:ConvertibleConvert the jdbc value to attribute format or type- Specified by:
toAttributein interfaceConvertible<Enum<?>,Integer>- Parameters:
jdbc- the value stored at database- Returns:
- the value of attribute converted
-
getType
public Class getType()
- Specified by:
getTypein interfaceConvertible<Enum<?>,Integer>
-
getColumnType
public ColumnType getColumnType()
- Specified by:
getColumnTypein interfaceConvertible<Enum<?>,Integer>
-
-