Class AttributeMapper<R>

java.lang.Object
no.digipost.jdbc.AttributeMapper<R>
Type Parameters:
R - The type of the Attribute and the result yielded from the ColumnMapper
All Implemented Interfaces:
RowMapper<R>

public final class AttributeMapper<R> extends Object implements RowMapper<R>
An attribute mapper associates a ColumnMapper with an Attribute, and is used internally by an AttributesRowMapper to produce an AttributesMap where the values can be accessed in a type-safe manner.

An AttributeMapper is constructed from an existing ColumnMapper by calling .forColumn(..).

Instances may be directly given to a constructor of an AttributesRowMapper, but can also be used as a standalone RowMapper.

  • Method Details

    • map

      public R map(ResultSet resultSet) throws SQLException
      For the current row of the given ResultSet, map the specific column(s) this AttributeMapper is set to handle. The mapper does not move the cursor of the ResultSet.
      Specified by:
      map in interface RowMapper<R>
      Parameters:
      resultSet - the ResultSet to retrieve necessary data from in order to yield the result of type R.
      Returns:
      the result
      Throws:
      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.