org.apache.commons.dbutils.handlers
Class ArrayHandler

java.lang.Object
  extended by org.apache.commons.dbutils.handlers.ArrayHandler
All Implemented Interfaces:
ResultSetHandler

public class ArrayHandler
extends java.lang.Object
implements ResultSetHandler

ResultSetHandler implementation that converts a ResultSet into an Object[]. This class is thread safe.

See Also:
ResultSetHandler

Field Summary
private  RowProcessor convert
          The RowProcessor implementation to use when converting rows into arrays.
(package private) static RowProcessor ROW_PROCESSOR
          Singleton processor instance that handlers share to save memory.
 
Constructor Summary
ArrayHandler()
          Creates a new instance of ArrayHandler using a BasicRowProcessor for conversion.
ArrayHandler(RowProcessor convert)
          Creates a new instance of ArrayHandler.
 
Method Summary
 java.lang.Object handle(java.sql.ResultSet rs)
          Places the column values from the first row in an Object[].
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROW_PROCESSOR

static final RowProcessor 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.


convert

private RowProcessor convert
The RowProcessor implementation to use when converting rows into arrays.

Constructor Detail

ArrayHandler

public ArrayHandler()
Creates a new instance of ArrayHandler using a BasicRowProcessor for conversion.


ArrayHandler

public ArrayHandler(RowProcessor convert)
Creates a new instance of ArrayHandler.

Parameters:
convert - The RowProcessor implementation to use when converting rows into arrays.
Method Detail

handle

public java.lang.Object handle(java.sql.ResultSet rs)
                        throws java.sql.SQLException
Places the column values from the first row in an Object[].

Specified by:
handle in interface ResultSetHandler
Parameters:
rs - The ResultSet to handle. It has not been touched before being passed to this method.
Returns:
An Object[] or null if there are no rows in the ResultSet.
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
ResultSetHandler.handle(java.sql.ResultSet)