Package org.apache.commons.dbutils
Interface RowProcessor
-
- All Known Implementing Classes:
BasicRowProcessor
public interface RowProcessorRowProcessorimplementations convertResultSetrows into various other objects. Implementations can extendBasicRowProcessorto protect themselves from changes to this interface.- See Also:
BasicRowProcessor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object[]toArray(java.sql.ResultSet rs)Create anObject[]from the column values in oneResultSetrow.<T> TtoBean(java.sql.ResultSet rs, java.lang.Class<? extends T> type)Create a JavaBean from the column values in oneResultSetrow.<T> java.util.List<T>toBeanList(java.sql.ResultSet rs, java.lang.Class<? extends T> type)Create aListof JavaBeans from the column values in allResultSetrows.java.util.Map<java.lang.String,java.lang.Object>toMap(java.sql.ResultSet rs)Create aMapfrom the column values in oneResultSetrow.
-
-
-
Method Detail
-
toArray
java.lang.Object[] toArray(java.sql.ResultSet rs) throws java.sql.SQLExceptionCreate anObject[]from the column values in oneResultSetrow. TheResultSetshould 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:
rs- ResultSet that supplies the array data- Returns:
- the newly created array
- Throws:
java.sql.SQLException- if a database access error occurs
-
toBean
<T> T toBean(java.sql.ResultSet rs, java.lang.Class<? extends T> type) throws java.sql.SQLExceptionCreate a JavaBean from the column values in oneResultSetrow. TheResultSetshould 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:
rs- ResultSet that supplies the bean datatype- Class from which to create the bean instance- Returns:
- the newly created bean
- Throws:
java.sql.SQLException- if a database access error occurs
-
toBeanList
<T> java.util.List<T> toBeanList(java.sql.ResultSet rs, java.lang.Class<? extends T> type) throws java.sql.SQLExceptionCreate aListof JavaBeans from the column values in allResultSetrows.ResultSet.next()should not be called before passing it to this method.- Type Parameters:
T- The type of bean to create- Parameters:
rs- ResultSet that supplies the bean datatype- Class from which to create the bean instance- Returns:
- A
Listof beans with the given type in the order they were returned by theResultSet. - Throws:
java.sql.SQLException- if a database access error occurs
-
toMap
java.util.Map<java.lang.String,java.lang.Object> toMap(java.sql.ResultSet rs) throws java.sql.SQLExceptionCreate aMapfrom the column values in oneResultSetrow. TheResultSetshould 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:
rs- ResultSet that supplies the map data- Returns:
- the newly created Map
- Throws:
java.sql.SQLException- if a database access error occurs
-
-