public abstract class TypedMapper<T> extends Object implements ResultSetMapper<T>
Constructor and Description |
---|
TypedMapper()
Create a new instance which extracts the value from the first column
|
TypedMapper(int index)
Create a new instance which extracts the value positionally
in the result set
|
TypedMapper(String name)
Create a new instance which extracts the value by name or alias from the result set
|
Modifier and Type | Method and Description |
---|---|
protected abstract T |
extractByIndex(ResultSet r,
int index) |
protected abstract T |
extractByName(ResultSet r,
String name) |
T |
map(int index,
ResultSet r,
StatementContext ctx)
Map the row the result set is at when passed in.
|
public TypedMapper()
public TypedMapper(int index)
index
- 1 based column index into the result setpublic TypedMapper(String name)
name
- The name or alias for the fieldprotected abstract T extractByIndex(ResultSet r, int index) throws SQLException
SQLException
protected abstract T extractByName(ResultSet r, String name) throws SQLException
SQLException
public final T map(int index, ResultSet r, StatementContext ctx) throws SQLException
ResultSetMapper
map
in interface ResultSetMapper<T>
index
- which row of the result set we are at, starts at 0r
- the result set being iteratedSQLException
- if anythign goes wrong go ahead and let this percolate, jDBI will handle itCopyright © 2023. All rights reserved.