public class BasicRowProcessor extends java.lang.Object implements RowProcessor
RowProcessor
interface.
This class is thread-safe.
RowProcessor
Constructor and Description |
---|
BasicRowProcessor()
BasicRowProcessor constructor.
|
BasicRowProcessor(BeanProcessor convert)
BasicRowProcessor constructor.
|
Modifier and Type | Method and Description |
---|---|
static BasicRowProcessor |
instance()
Deprecated.
Create instances with the constructors instead. This will
be removed after DbUtils 1.1.
|
java.lang.Object[] |
toArray(java.sql.ResultSet rs)
Convert a
ResultSet row into an Object[] . |
java.lang.Object |
toBean(java.sql.ResultSet rs,
java.lang.Class type)
Convert a
ResultSet row into a JavaBean. |
java.util.List |
toBeanList(java.sql.ResultSet rs,
java.lang.Class type)
Convert a
ResultSet into a List of JavaBeans. |
java.util.Map |
toMap(java.sql.ResultSet rs)
Convert a
ResultSet row into a Map . |
public BasicRowProcessor()
public BasicRowProcessor(BeanProcessor convert)
convert
- The BeanProcessor to use when converting columns to
bean properties.public static BasicRowProcessor instance()
public java.lang.Object[] toArray(java.sql.ResultSet rs) throws java.sql.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 datajava.sql.SQLException
- if a database access error occurspublic java.lang.Object toBean(java.sql.ResultSet rs, java.lang.Class type) throws java.sql.SQLException
ResultSet
row into a JavaBean. This
implementation delegates to a BeanProcessor instance.toBean
in interface RowProcessor
rs
- ResultSet that supplies the bean datatype
- Class from which to create the bean instancejava.sql.SQLException
- if a database access error occurspublic java.util.List toBeanList(java.sql.ResultSet rs, java.lang.Class type) throws java.sql.SQLException
ResultSet
into a List
of JavaBeans.
This implementation delegates to a BeanProcessor instance.toBeanList
in interface RowProcessor
rs
- ResultSet that supplies the bean datatype
- Class from which to create the bean instanceList
of beans with the given type in the order
they were returned by the ResultSet
.java.sql.SQLException
- if a database access error occurspublic java.util.Map toMap(java.sql.ResultSet rs) throws java.sql.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 datajava.sql.SQLException
- if a database access error occurs