Package org.jdbi.v3.core.mapper
Class EnumMapper<E extends Enum<E>>
java.lang.Object
org.jdbi.v3.core.mapper.EnumMapper<E>
- Type Parameters:
E- the enum type mapped
- All Implemented Interfaces:
ColumnMapper<E>
Column mapper for Java
enum types.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classEnumMapper.EnumByNameColumnMapper<E extends Enum<E>>(package private) static classEnumMapper.EnumByOrdinalColumnMapper<E extends Enum<E>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends Enum<E>>
ColumnMapper<E>Map database string values to enum names.static <E extends Enum<E>>
ColumnMapper<E>Map database integer values to enum ordinal values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jdbi.v3.core.mapper.ColumnMapper
init, map, map
-
Constructor Details
-
EnumMapper
EnumMapper()
-
-
Method Details
-
byName
Map database string values to enum names.- Type Parameters:
E- the enum type to map- Parameters:
type- the enum type to map- Returns:
- an enum mapper that matches on
Enum.name()
-
byOrdinal
Map database integer values to enum ordinal values.- Type Parameters:
E- the enum type to map- Parameters:
type- the enum type to map- Returns:
- an enum mapper that matches on
Enum.ordinal()
-