commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils DbUtils.java
Date Thu, 16 Oct 2003 03:04:42 GMT
dgraham     2003/10/15 20:04:42

  Modified:    dbutils/src/java/org/apache/commons/dbutils DbUtils.java
  Log:
  Changed resultSetToBean() to take a Class instead of an Object for
  consistency with the resultSetToBeanCollection() method.  This also
  makes the BeanHandler implementation easier.
  
  Revision  Changes    Path
  1.33      +11 -8     jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java
  
  Index: DbUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbUtils.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DbUtils.java	15 Oct 2003 04:39:27 -0000	1.32
  +++ DbUtils.java	16 Oct 2003 03:04:42 -0000	1.33
  @@ -359,13 +359,16 @@
       }
       
       /**
  -     * Create a Bean from a ResultSet.
  -     * It is assumed that next() has already been called on the ResultSet.
  +     * Create a JavaBean from a <code>ResultSet</code>.  It is assumed 
  +     * that <code>next()</code> has already been called on the 
  +     * <code>ResultSet</code>.
        */
  -    public static Object resultSetToBean(ResultSet rs, Object obj)
  +    public static Object resultSetToBean(ResultSet rs, Class cls)
           throws SQLException {
   
  -        PropertyDescriptor[] pd = propertyDescriptors(obj.getClass());
  +        Object obj = newInstance(cls);
  +
  +        PropertyDescriptor[] pd = propertyDescriptors(cls);
   
           ResultSetMetaData rsmd = rs.getMetaData();
           int cols = rsmd.getColumnCount();
  @@ -382,7 +385,7 @@
                       continue LOOP;
                   }
               }
  -            
  +
               throw new SQLException(
                   columnName + " not found in " + obj.getClass().getName());
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message