|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.dbutils.BasicRowProcessor
public class BasicRowProcessor
Basic implementation of the RowProcessor
interface.
This class is thread-safe.
RowProcessor
Constructor Summary | |
---|---|
BasicRowProcessor()
BasicRowProcessor constructor. |
|
BasicRowProcessor(BeanProcessor convert)
BasicRowProcessor constructor. |
Method Summary | ||
---|---|---|
static BasicRowProcessor |
instance()
Deprecated. Create instances with the constructors instead. This will be removed after DbUtils 1.1. |
|
Object[] |
toArray(ResultSet rs)
Convert a ResultSet row into an Object[] . |
|
|
toBean(ResultSet rs,
Class<T> type)
Convert a ResultSet row into a JavaBean. |
|
|
toBeanList(ResultSet rs,
Class<T> type)
Convert a ResultSet into a List of JavaBeans. |
|
Map<String,Object> |
toMap(ResultSet rs)
Convert a ResultSet row into a Map . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicRowProcessor()
public BasicRowProcessor(BeanProcessor convert)
convert
- The BeanProcessor to use when converting columns to
bean properties.Method Detail |
---|
@Deprecated public static BasicRowProcessor instance()
public Object[] toArray(ResultSet rs) throws SQLException
ResultSet
row into an Object[]
.
This implementation copies column values into the array in the same
order they're returned from the ResultSet
. Array elements
will be set to null
if the column was SQL NULL.
toArray
in interface RowProcessor
rs
- ResultSet that supplies the array data
SQLException
- if a database access error occursRowProcessor.toArray(java.sql.ResultSet)
public <T> T toBean(ResultSet rs, Class<T> type) throws SQLException
ResultSet
row into a JavaBean. This
implementation delegates to a BeanProcessor instance.
toBean
in interface RowProcessor
T
- The type of bean to creaters
- ResultSet that supplies the bean datatype
- Class from which to create the bean instance
SQLException
- if a database access error occursRowProcessor.toBean(java.sql.ResultSet, java.lang.Class)
,
BeanProcessor.toBean(java.sql.ResultSet, java.lang.Class)
public <T> List<T> toBeanList(ResultSet rs, Class<T> type) throws SQLException
ResultSet
into a List
of JavaBeans.
This implementation delegates to a BeanProcessor instance.
toBeanList
in interface RowProcessor
T
- The type of bean to creaters
- ResultSet that supplies the bean datatype
- Class from which to create the bean instance
List
of beans with the given type in the order
they were returned by the ResultSet
.
SQLException
- if a database access error occursRowProcessor.toBeanList(java.sql.ResultSet, java.lang.Class)
,
BeanProcessor.toBeanList(java.sql.ResultSet, java.lang.Class)
public Map<String,Object> toMap(ResultSet rs) throws SQLException
ResultSet
row into a Map
. This
implementation returns a Map
with case insensitive column
names as keys. Calls to map.get("COL")
and
map.get("col")
return the same value.
toMap
in interface RowProcessor
rs
- ResultSet that supplies the map data
SQLException
- if a database access error occursRowProcessor.toMap(java.sql.ResultSet)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |