T - the mapped type.@FunctionalInterface public interface RowMapper<T>
| Modifier and Type | Method and Description |
|---|---|
T |
map(ResultSet rs,
StatementContext ctx)
Map the row the result set is at when passed in.
|
default RowMapper<T> |
specialize(ResultSet rs,
StatementContext ctx)
Returns a specialized row mapper, optimized for the given result set.
|
T map(ResultSet rs, StatementContext ctx) throws SQLException
rs - the result set being iteratedctx - the statement contextSQLException - if anything goes wrong go ahead and let this percolate; Jdbi will handle itdefault RowMapper<T> specialize(ResultSet rs, StatementContext ctx) throws SQLException
Before mapping the result set from a SQL statement; Jdbi will first call this method to obtain a specialized instance. The returned mapper will then be used to map the result set rows, and discarded.
Implementing this method is optional; the default implementation returns this. Implementors might choose
to override this method to improve performance, e.g. by matching up column names to properties once for the
entire result set, rather than repeating the process for every row.
rs - the result set to specialize overctx - the statement context to specialize overSQLException - if anything goes wrong go ahead and let this percolate; Jdbi will handle itfor an example of specialization.Copyright © 2017. All rights reserved.