Class SingleColumnMapper<T>

java.lang.Object
org.jdbi.v3.core.mapper.SingleColumnMapper<T>
All Implemented Interfaces:
RowMapper<T>

public class SingleColumnMapper<T> extends Object implements RowMapper<T>
Adapts a ColumnMapper into a RowMapper by mapping a single column.
  • Constructor Details

    • SingleColumnMapper

      public SingleColumnMapper(ColumnMapper<T> mapper)
      Constructs a row mapper which maps the first column.
      Parameters:
      mapper - the column mapper to delegate to for mapping.
    • SingleColumnMapper

      public SingleColumnMapper(ColumnMapper<T> mapper, int columnNumber)
      Constructs a row mapper which maps the given column number.
      Parameters:
      mapper - the column mapper to delegate to for mapping
      columnNumber - the column number (1-based) to map
    • SingleColumnMapper

      public SingleColumnMapper(ColumnMapper<T> mapper, String columnLabel)
      Constructs a row mapper which maps the column with the given label.
      Parameters:
      mapper - the column mapper to delegate to for mapping
      columnLabel - the label of the column to map
  • Method Details

    • map

      public T map(ResultSet r, StatementContext ctx) throws SQLException
      Description copied from interface: RowMapper
      Map the current row of the result set. This method should not cause the result set to advance; allow Jdbi to do that, please.
      Specified by:
      map in interface RowMapper<T>
      Parameters:
      r - the result set being iterated
      ctx - the statement context
      Returns:
      the value to produce for this row
      Throws:
      SQLException - if anything goes wrong go ahead and let this percolate; Jdbi will handle it