You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by df...@apache.org on 2009/02/10 21:52:10 UTC
svn commit: r743097 -
/commons/sandbox/dbutils/bugfixing/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
Author: dfabulich
Date: Tue Feb 10 20:52:10 2009
New Revision: 743097
URL: http://svn.apache.org/viewvc?rev=743097&view=rev
Log:
[DBUTILS-37] BeanListHandler#handle(ResultSet) is not optimal
Submitted by: Julien Aymé
Julien's patch created a separate OptimalBeanListHandler to avoid breaking users who had extended BeanListHandler; I chose to just replace the existing one rather than clutter the API
Modified:
commons/sandbox/dbutils/bugfixing/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
Modified: commons/sandbox/dbutils/bugfixing/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/dbutils/bugfixing/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java?rev=743097&r1=743096&r2=743097&view=diff
==============================================================================
--- commons/sandbox/dbutils/bugfixing/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java (original)
+++ commons/sandbox/dbutils/bugfixing/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java Tue Feb 10 20:52:10 2009
@@ -19,6 +19,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
+import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.RowProcessor;
/**
@@ -28,7 +29,7 @@
*
* @see org.apache.commons.dbutils.ResultSetHandler
*/
-public class BeanListHandler extends GenericListHandler {
+public class BeanListHandler implements ResultSetHandler {
/**
* The Class of beans produced by this handler.
@@ -65,16 +66,17 @@
}
/**
- * Convert the <code>ResultSet</code> row into a bean with
+ * Convert the whole <code>ResultSet</code> into a List of beans with
* the <code>Class</code> given in the constructor.
*
- * @return A bean, never <code>null</code>.
+ * @param rs The <code>ResultSet</code> to handle.
+ *
+ * @return A List of beans, never <code>null</code>.
*
* @throws SQLException if a database access error occurs
- * @see org.apache.commons.dbutils.handlers.GenericListHandler#handle(ResultSet)
+ * @see org.apache.commons.dbutils.RowProcessor#toBeanList(ResultSet, Class)
*/
- protected Object handleRow(ResultSet rs) throws SQLException {
- return this.convert.toBean(rs, type);
+ public Object handle(ResultSet rs) throws SQLException {
+ return this.convert.toBeanList(rs, type);
}
-
}