Package org.jdbi.v3.core.mapper
Interface ColumnMapper<T>
- Type Parameters:
T
- The mapped type
- All Known Implementing Classes:
DateTimeMapper
,EnumMapper
,HStoreColumnMapper
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Maps result set columns to objects.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <U> ColumnMapper<U>
default void
init
(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 T
map
(ResultSet r, String columnLabel, StatementContext ctx) Map the given column of the current row of the result set to an Object.
-
Method Details
-
getDefaultColumnMapper
-
map
Map the given column of the current row of the result set to an Object. This method should not cause the result set to advance; allow Jdbi to do that, please.- Parameters:
r
- the result set being iteratedcolumnNumber
- the column number to map (starts at 1)ctx
- the statement context- Returns:
- the value to return for this column
- Throws:
SQLException
- if anything goes wrong go ahead and let this percolate; Jdbi will handle it
-
map
Map the given column of the current row of the result set to an Object. This method should not cause the result set to advance; allow Jdbi to do that, please.- Parameters:
r
- the result set being iteratedcolumnLabel
- the column label to mapctx
- the statement context- Returns:
- the value to return for this column
- Throws:
SQLException
- if anything goes wrong go ahead and let this percolate; Jdbi will handle it
-
init
Allows for initialization of the column mapper instance within a ConfigRegistry scope. This method is called once when the column mapper is first used from a ConfigRegistry.Note that handles, statements, sql objects etc. all create copies of the registry, and this method will be called for every copy
- Parameters:
registry
- A reference to theConfigRegistry
that this instance belongs to.
-