T
- the target bean typepublic class BeanHandler<T> extends Object implements ResultSetHandler<T>
ResultSetHandler
implementation that converts the first
ResultSet
row into a JavaBean. This class is thread safe.ResultSetHandler
Constructor and Description |
---|
BeanHandler(Class<? extends T> type)
Creates a new instance of BeanHandler.
|
BeanHandler(Class<? extends T> type,
RowProcessor convert)
Creates a new instance of BeanHandler.
|
Modifier and Type | Method and Description |
---|---|
T |
handle(ResultSet resultSet)
Convert the first row of the
ResultSet into a bean with the
Class given in the constructor. |
public BeanHandler(Class<? extends T> type)
type
- The Class that objects returned from handle()
are created from.public BeanHandler(Class<? extends T> type, RowProcessor convert)
type
- The Class that objects returned from handle()
are created from.convert
- The RowProcessor
implementation
to use when converting rows into beans.public T handle(ResultSet resultSet) throws SQLException
ResultSet
into a bean with the
Class
given in the constructor.handle
in interface ResultSetHandler<T>
resultSet
- ResultSet
to process.null
if there were no
rows in the ResultSet
.SQLException
- if a database access error occursResultSetHandler.handle(java.sql.ResultSet)
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.