Class ArrayHandler
java.lang.Object
org.apache.commons.dbutils.handlers.ArrayHandler
- All Implemented Interfaces:
ResultSetHandler<Object[]>
ResultSetHandler
implementation that converts a
ResultSet
into an Object[]
. This class is
thread safe.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RowProcessor
The RowProcessor implementation to use when converting rows into arrays.private static final Object[]
An empty array to return when no more rows are available in the ResultSet.(package private) static final RowProcessor
Singleton processor instance that handlers share to save memory. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of ArrayHandler using aBasicRowProcessor
for conversion.ArrayHandler
(RowProcessor convert) Creates a new instance of ArrayHandler. -
Method Summary
-
Field Details
-
ROW_PROCESSOR
Singleton processor instance that handlers share to save memory. Notice the default scoping to allow only classes in this package to use this instance. -
EMPTY_ARRAY
An empty array to return when no more rows are available in the ResultSet. -
convert
The RowProcessor implementation to use when converting rows into arrays.
-
-
Constructor Details
-
ArrayHandler
public ArrayHandler()Creates a new instance of ArrayHandler using aBasicRowProcessor
for conversion. -
ArrayHandler
Creates a new instance of ArrayHandler.- Parameters:
convert
- TheRowProcessor
implementation to use when converting rows into arrays.
-
-
Method Details
-
handle
Places the column values from the first row in anObject[]
.- Specified by:
handle
in interfaceResultSetHandler<Object[]>
- Parameters:
rs
-ResultSet
to process.- Returns:
- An Object[]. If there are no rows in the
ResultSet
an empty array will be returned. - Throws:
SQLException
- if a database access error occurs- See Also:
-