Package org.apache.commons.dbutils
Interface RowProcessor
-
- All Known Implementing Classes:
BasicRowProcessor
public interface RowProcessor
RowProcessor
implementations convertResultSet
rows into various other objects. Implementations can extendBasicRowProcessor
to protect themselves from changes to this interface.- See Also:
BasicRowProcessor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object[]
toArray(ResultSet resultSet)
Create anObject[]
from the column values in oneResultSet
row.<T> T
toBean(ResultSet resultSet, Class<? extends T> type)
Create a JavaBean from the column values in oneResultSet
row.<T> List<T>
toBeanList(ResultSet resultSet, Class<? extends T> type)
Create aList
of JavaBeans from the column values in allResultSet
rows.Map<String,Object>
toMap(ResultSet resultSet)
Create aMap
from the column values in oneResultSet
row.
-
-
-
Method Detail
-
toArray
Object[] toArray(ResultSet resultSet) throws SQLException
Create anObject[]
from the column values in oneResultSet
row. TheResultSet
should be positioned on a valid row before passing it to this method. Implementations of this method must not alter the row position of theResultSet
.- Parameters:
resultSet
- ResultSet that supplies the array data- Returns:
- the newly created array
- Throws:
SQLException
- if a database access error occurs
-
toBean
<T> T toBean(ResultSet resultSet, Class<? extends T> type) throws SQLException
Create a JavaBean from the column values in oneResultSet
row. TheResultSet
should be positioned on a valid row before passing it to this method. Implementations of this method must not alter the row position of theResultSet
.- Type Parameters:
T
- The type of bean to create- Parameters:
resultSet
- ResultSet that supplies the bean datatype
- Class from which to create the bean instance- Returns:
- the newly created bean
- Throws:
SQLException
- if a database access error occurs
-
toBeanList
<T> List<T> toBeanList(ResultSet resultSet, Class<? extends T> type) throws SQLException
Create aList
of JavaBeans from the column values in allResultSet
rows.ResultSet.next()
should not be called before passing it to this method.- Type Parameters:
T
- The type of bean to create- Parameters:
resultSet
- ResultSet that supplies the bean datatype
- Class from which to create the bean instance- Returns:
- A
List
of beans with the given type in the order they were returned by theResultSet
. - Throws:
SQLException
- if a database access error occurs
-
toMap
Map<String,Object> toMap(ResultSet resultSet) throws SQLException
Create aMap
from the column values in oneResultSet
row. TheResultSet
should be positioned on a valid row before passing it to this method. Implementations of this method must not alter the row position of theResultSet
.- Parameters:
resultSet
- ResultSet that supplies the map data- Returns:
- the newly created Map
- Throws:
SQLException
- if a database access error occurs
-
-