T
- The type of the column. When no class is specified via the constructor, this must match or be a super-type of what is returned by the ResultSet
.public class ColumnRowProcessor<T> extends Object implements RowProcessor<T>
ResultSet
column into an instance of T. This class is thread safe.Constructor and Description |
---|
ColumnRowProcessor(int columnIndex) |
ColumnRowProcessor(int columnIndex,
Class<T> objectClass) |
ColumnRowProcessor(String columnName) |
ColumnRowProcessor(String columnName,
Class<T> objectClass) |
Modifier and Type | Method and Description |
---|---|
T |
handle(ResultSet rs) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
firstColumn, firstColumn, optional
public ColumnRowProcessor(int columnIndex)
columnIndex
- The index of the column to retrieve from the ResultSet
.public ColumnRowProcessor(int columnIndex, Class<T> objectClass)
columnIndex
- The index of the column to retrieve from the ResultSet
.objectClass
- The class of the returned instance. Makes custom conversion possible.public ColumnRowProcessor(String columnName)
columnName
- The name of the column to retrieve from the ResultSet
.public T handle(ResultSet rs) throws SQLException
handle
in interface RowProcessor<T>
rs
- ResultSet
to process.SQLException
- if a database access error occursClassCastException
- if no class was specified and T does not match the column typeCopyright © 2014. All rights reserved.