Interface ColumnHandler

All Known Implementing Classes:
BooleanColumnHandler, ByteColumnHandler, DoubleColumnHandler, FloatColumnHandler, IntegerColumnHandler, LongColumnHandler, ShortColumnHandler, SQLXMLColumnHandler, StringColumnHandler, TimestampColumnHandler

public interface ColumnHandler
Interface to define how implementations can interact with column handling when constructing a bean from a ResultSet. ColumnHandlers do the work of retrieving data correctly from the ResultSet.
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(ResultSet rs, int columnIndex)
    Do the work required to retrieve and store a column from ResultSet into something of type propType.
    boolean
    match(Class<?> propType)
    Test whether this ColumnHandler wants to handle a column targeted for a value type matching propType.
  • Method Details

    • match

      boolean match(Class<?> propType)
      Test whether this ColumnHandler wants to handle a column targeted for a value type matching propType.
      Parameters:
      propType - The type of the target parameter.
      Returns:
      true is this property handler can/wants to handle this value; false otherwise.
    • apply

      Object apply(ResultSet rs, int columnIndex) throws SQLException
      Do the work required to retrieve and store a column from ResultSet into something of type propType. This method is called only if this handler responded true after a call to match(Class).
      Parameters:
      rs - The result set to get data from. This should be moved to the correct row already.
      columnIndex - The position of the column to retrieve.
      Returns:
      The converted value or the original value if something doesn't work out.
      Throws:
      SQLException - if the columnIndex is not valid; if a database access error occurs or this method is called on a closed result set