Package org.apache.commons.dbutils
Interface ColumnHandler<T>
-
- Type Parameters:
T
- The return type.
- All Known Implementing Classes:
BooleanColumnHandler
,ByteColumnHandler
,DoubleColumnHandler
,FloatColumnHandler
,IntegerColumnHandler
,LongColumnHandler
,ShortColumnHandler
,SQLXMLColumnHandler
,StringColumnHandler
,TimestampColumnHandler
public interface ColumnHandler<T>
Defines how to process columns when constructing a bean from aResultSet
. Instances do the work of retrieving data from aResultSet
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
apply(ResultSet resultSet, int columnIndex)
Retrieves the current row's column value from aResultSet
and stores it into an instance ofpropType
.boolean
match(Class<?> propType)
Tests whether to handle a column targeted for a value type matchingpropType
.
-
-
-
Method Detail
-
apply
T apply(ResultSet resultSet, int columnIndex) throws SQLException
Retrieves the current row's column value from aResultSet
and stores it into an instance ofpropType
. This method is only called ifmatch(Class)
returns true.- Parameters:
resultSet
- The source result set. This must be on the correct row.columnIndex
- The position of the column to retrieve, a 1-based index.- 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
-
-