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:
-
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 Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ColumnMapper
init, map, mapModifier and TypeMethodDescriptiondefault voidinit(ConfigRegistry registry) Allows for initialization of the column mapper instance within a ConfigRegistry scope.map(ResultSet r, int columnNumber, StatementContext ctx) Map the given column of the current row of the result set to an Object.default Emap(ResultSet r, String columnLabel, StatementContext ctx) Map the given column of the current row of the result set to an Object.
-
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()
-