public class MapMapper extends Object implements RowMapper<Map<String,Object>>
Map<String,Object>. Map
keys are column names, while map values are the values in those columns. Map keys are converted to lowercase by
default.GenericMapMapperFactory| Constructor and Description |
|---|
MapMapper()
Constructs a new MapMapper and delegates case control to MapMappers.
|
MapMapper(boolean toLowerCase)
Constructs a new MapMapper
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
map(ResultSet rs,
StatementContext ctx)
Map the current row of the result set.
|
RowMapper<Map<String,Object>> |
specialize(ResultSet rs,
StatementContext ctx)
Returns a specialized row mapper, optimized for the given result set.
|
public MapMapper()
public MapMapper(boolean toLowerCase)
toLowerCase - if true, column names are converted to lowercase in the mapped Map. If false, nothing is done. Use the other constructor to delegate case control to MapMappers instead.public Map<String,Object> map(ResultSet rs, StatementContext ctx) throws SQLException
RowMapperpublic RowMapper<Map<String,Object>> specialize(ResultSet rs, StatementContext ctx) throws SQLException
RowMapperBefore 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.
specialize in interface RowMapper<Map<String,Object>>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 © 2019. All rights reserved.