R - The type of object this ColumnMapper yields from a ResultSet@FunctionalInterface public interface ColumnMapper<R>
ColumnMapper differ from a RowMapper in that it is also given a column label/name
together with the ResultSet, which can be used to process specific column(s).
Typically, a ColumnMapper defines how a extract the value from a certain type of columns,
say INT, VARCHAR, or TIMESTAMP columns. Mappers for these value types and other common basic
mappers can be found in the Mappers class. A ColumnMapper can be specialized to handle one specific column
with forColumn(Attribute), which turns it into a RowMapper.BasicColumnMapper,
NullableColumnMapper| Modifier and Type | Method and Description |
|---|---|
default AttributeMapper<R> |
forColumn(Attribute<R> attribute)
Associate the column mapper with an
Attribute. |
R |
map(String name,
ResultSet resultSet)
Extract a value from a
ResultSet based on the given name. |
R map(String name, ResultSet resultSet) throws SQLException
ResultSet based on the given name. Usually the name is the
column name, or column label if an SQL AS clause was used in the query. The given ResultSet
is expected to be positioned at the "current" row, i.e. the ColumnMapper is not expected to be
required to do any cursor placement before doing any value extraction.name - the name of the value to extract, usually the column name, or column label if an
SQL AS clause was used in the query.resultSet - the ResultSet to extract from.SQLException - if any error happens when processing the ResultSet. May be if the name/label is not valid,
if a database access error occurs, or this method is called on a closed result set.default AttributeMapper<R> forColumn(Attribute<R> attribute)
Attribute. This will create a row mapper
for the column named by the given attribute.AttributeMapper, which is a row mapper.Copyright © 2018 Digipost. All rights reserved.