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<List<T>>
ResultSetHandler
implementation that converts one
ResultSet
column into a List
of
Object
s. This class is thread safe.- Since:
- DbUtils 1.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The column number to retrieve.private final String
The column name to retrieve. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates a new instance of ColumnListHandler.ColumnListHandler
(int columnIndex) Creates a new instance of ColumnListHandler.private
ColumnListHandler
(int columnIndex, String columnName) Private HelperColumnListHandler
(String columnName) Creates a new instance of ColumnListHandler. -
Method Summary
Methods inherited from class org.apache.commons.dbutils.handlers.AbstractListHandler
handle
-
Field Details
-
columnIndex
private final int columnIndexThe column number to retrieve. -
columnName
The column name to retrieve. Either columnName or columnIndex will be used but never both.
-
-
Constructor Details
-
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
Creates a new instance of ColumnListHandler.- Parameters:
columnName
- The name of the column to retrieve from theResultSet
.
-
ColumnListHandler
Private Helper- Parameters:
columnIndex
- The index of the column to retrieve from theResultSet
.columnName
- The name of the column to retrieve from theResultSet
.
-
-
Method Details
-
handleRow
Returns oneResultSet
column value asObject
.- Specified by:
handleRow
in classAbstractListHandler<T>
- Parameters:
rs
-ResultSet
to process.- Returns:
Object
, nevernull
.- Throws:
SQLException
- if a database access error occursClassCastException
- if the class datatype does not match the column type- See Also:
-