Class ColumnListHandler<T>
- java.lang.Object
-
- org.apache.commons.dbutils.handlers.AbstractListHandler<T>
-
- org.apache.commons.dbutils.handlers.ColumnListHandler<T>
-
- Type Parameters:
T
- The type of the column.
- All Implemented Interfaces:
ResultSetHandler<java.util.List<T>>
public class ColumnListHandler<T> extends AbstractListHandler<T>
ResultSetHandler
implementation that converts oneResultSet
column into aList
ofObject
s. This class is thread safe.- Since:
- DbUtils 1.1
- See Also:
ResultSetHandler
-
-
Field Summary
Fields Modifier and Type Field Description private int
columnIndex
The column number to retrieve.private java.lang.String
columnName
The column name to retrieve.
-
Constructor Summary
Constructors Modifier Constructor Description ColumnListHandler()
Creates a new instance of ColumnListHandler.ColumnListHandler(int columnIndex)
Creates a new instance of ColumnListHandler.private
ColumnListHandler(int columnIndex, java.lang.String columnName)
Private HelperColumnListHandler(java.lang.String columnName)
Creates a new instance of ColumnListHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected T
handleRow(java.sql.ResultSet rs)
Returns oneResultSet
column value asObject
.-
Methods inherited from class org.apache.commons.dbutils.handlers.AbstractListHandler
handle
-
-
-
-
Constructor Detail
-
ColumnListHandler
public ColumnListHandler()
Creates a new instance of ColumnListHandler. The first column of each row will be returned fromhandle()
.
-
ColumnListHandler
public ColumnListHandler(int columnIndex)
Creates a new instance of ColumnListHandler.- Parameters:
columnIndex
- The index of the column to retrieve from theResultSet
.
-
ColumnListHandler
public ColumnListHandler(java.lang.String columnName)
Creates a new instance of ColumnListHandler.- Parameters:
columnName
- The name of the column to retrieve from theResultSet
.
-
ColumnListHandler
private ColumnListHandler(int columnIndex, java.lang.String columnName)
Private Helper- Parameters:
columnIndex
- The index of the column to retrieve from theResultSet
.columnName
- The name of the column to retrieve from theResultSet
.
-
-
Method Detail
-
handleRow
protected T handleRow(java.sql.ResultSet rs) throws java.sql.SQLException
Returns oneResultSet
column value asObject
.- Specified by:
handleRow
in classAbstractListHandler<T>
- Parameters:
rs
-ResultSet
to process.- Returns:
Object
, nevernull
.- Throws:
java.sql.SQLException
- if a database access error occursjava.lang.ClassCastException
- if the class datatype does not match the column type- See Also:
AbstractListHandler.handle(ResultSet)
-
-