org.apache.commons.dbutils.handlers
Class BeanListHandler

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

public class BeanListHandler
extends GenericListHandler

ResultSetHandler implementation that converts a ResultSet into a List of beans. This class is thread safe.

See Also:
ResultSetHandler

Field Summary
private  RowProcessor convert
          The RowProcessor implementation to use when converting rows into beans.
private  java.lang.Class type
          The Class of beans produced by this handler.
 
Constructor Summary
BeanListHandler(java.lang.Class type)
          Creates a new instance of BeanListHandler.
BeanListHandler(java.lang.Class type, RowProcessor convert)
          Creates a new instance of BeanListHandler.
 
Method Summary
protected  java.lang.Object handleRow(java.sql.ResultSet rs)
          Convert the ResultSet row into a bean with the Class given in the constructor.
 
Methods inherited from class org.apache.commons.dbutils.handlers.GenericListHandler
handle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

private java.lang.Class type
The Class of beans produced by this handler.


convert

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

Constructor Detail

BeanListHandler

public BeanListHandler(java.lang.Class type)
Creates a new instance of BeanListHandler.

Parameters:
type - The Class that objects returned from handle() are created from.

BeanListHandler

public BeanListHandler(java.lang.Class type,
                       RowProcessor convert)
Creates a new instance of BeanListHandler.

Parameters:
type - The Class that objects returned from handle() are created from.
convert - The RowProcessor implementation to use when converting rows into beans.
Method Detail

handleRow

protected java.lang.Object handleRow(java.sql.ResultSet rs)
                              throws java.sql.SQLException
Convert the ResultSet row into a bean with the Class given in the constructor.

Specified by:
handleRow in class GenericListHandler
Parameters:
rs - ResultSet to process.
Returns:
A bean, never null.
Throws:
java.sql.SQLException - if a database access error occurs
See Also:
GenericListHandler.handle(ResultSet)