commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfabul...@apache.org
Subject svn commit: r752368 - /commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/
Date Wed, 11 Mar 2009 04:45:01 GMT
Author: dfabulich
Date: Wed Mar 11 04:45:00 2009
New Revision: 752368

URL: http://svn.apache.org/viewvc?rev=752368&view=rev
Log:
Incorporating sebb's dbutils_handlers.patch for DBUTILS-51

Modified:
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
    commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
Wed Mar 11 04:45:00 2009
@@ -43,14 +43,14 @@
      * The RowProcessor implementation to use when converting rows 
      * into arrays.
      */
-    private RowProcessor convert = ROW_PROCESSOR;
+    private final RowProcessor convert;
 
     /** 
      * Creates a new instance of ArrayHandler using a 
      * <code>BasicRowProcessor</code> for conversion.
      */
     public ArrayHandler() {
-        super();
+        this(ROW_PROCESSOR);
     }
 
     /** 

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
Wed Mar 11 04:45:00 2009
@@ -34,14 +34,14 @@
      * The RowProcessor implementation to use when converting rows 
      * into Object[]s.
      */
-    private RowProcessor convert = ArrayHandler.ROW_PROCESSOR;
+    private final RowProcessor convert;
 
     /** 
      * Creates a new instance of ArrayListHandler using a 
      * <code>BasicRowProcessor</code> for conversions.
      */
     public ArrayListHandler() {
-        super();
+        this(ArrayHandler.ROW_PROCESSOR);
     }
 
     /** 

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanHandler.java
Wed Mar 11 04:45:00 2009
@@ -33,13 +33,13 @@
     /**
      * The Class of beans produced by this handler.
      */
-    private Class type = null;
+    private final Class type;
 
     /**
      * The RowProcessor implementation to use when converting rows 
      * into beans.
      */
-    private RowProcessor convert = ArrayHandler.ROW_PROCESSOR;
+    private final RowProcessor convert;
 
     /** 
      * Creates a new instance of BeanHandler.
@@ -48,7 +48,7 @@
      * are created from.
      */
     public BeanHandler(Class type) {
-        this.type = type;
+        this(type, ArrayHandler.ROW_PROCESSOR);
     }
 
     /** 

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
Wed Mar 11 04:45:00 2009
@@ -34,13 +34,13 @@
     /**
      * The Class of beans produced by this handler.
      */
-    private Class type = null;
+    private final Class type;
 
     /**
      * The RowProcessor implementation to use when converting rows 
      * into beans.
      */
-    private RowProcessor convert = ArrayHandler.ROW_PROCESSOR;
+    private final RowProcessor convert;
 
     /** 
      * Creates a new instance of BeanListHandler.
@@ -49,7 +49,7 @@
      * are created from.
      */
     public BeanListHandler(Class type) {
-        this.type = type;
+        this(type, ArrayHandler.ROW_PROCESSOR);
     }
 
     /** 

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
Wed Mar 11 04:45:00 2009
@@ -32,20 +32,20 @@
     /**
      * The column number to retrieve.
      */
-    private int columnIndex = 1;
+    private final int columnIndex;
 
     /**
      * The column name to retrieve.  Either columnName or columnIndex
      * will be used but never both.
      */
-    private String columnName = null;
+    private final String columnName;
 
     /** 
      * Creates a new instance of ColumnListHandler.  The first column of each
      * row will be returned from <code>handle()</code>.
      */
     public ColumnListHandler() {
-        super();
+        this(1, null);
     }
 
     /** 
@@ -55,7 +55,7 @@
      * <code>ResultSet</code>.
      */
     public ColumnListHandler(int columnIndex) {
-        this.columnIndex = columnIndex;
+        this(columnIndex, null);
     }
 
     /** 
@@ -65,9 +65,16 @@
      * <code>ResultSet</code>.
      */
     public ColumnListHandler(String columnName) {
-        this.columnName = columnName;
+        this(1, columnName);
     }
 
+    // Helper
+    private ColumnListHandler(int columnIndex, String columnName) {
+        super();
+        this.columnIndex = columnIndex;
+        this.columnName = columnName;        
+    }
+    
     /**
      * Returns one <code>ResultSet</code> column value as <code>Object</code>.
      * 

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapHandler.java
Wed Mar 11 04:45:00 2009
@@ -35,14 +35,14 @@
      * The RowProcessor implementation to use when converting rows 
      * into Maps.
      */
-    private RowProcessor convert = ArrayHandler.ROW_PROCESSOR;
+    private final RowProcessor convert;
 
     /** 
      * Creates a new instance of MapHandler using a 
      * <code>BasicRowProcessor</code> for conversion.
      */
     public MapHandler() {
-        super();
+        this(ArrayHandler.ROW_PROCESSOR);
     }
 
     /** 

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/MapListHandler.java
Wed Mar 11 04:45:00 2009
@@ -34,14 +34,14 @@
      * The RowProcessor implementation to use when converting rows 
      * into Maps.
      */
-    private RowProcessor convert = ArrayHandler.ROW_PROCESSOR;
+    private final RowProcessor convert;
 
     /** 
      * Creates a new instance of MapListHandler using a 
      * <code>BasicRowProcessor</code> for conversion.
      */
     public MapListHandler() {
-        super();
+        this(ArrayHandler.ROW_PROCESSOR);
     }
 
     /** 

Modified: commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java?rev=752368&r1=752367&r2=752368&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
(original)
+++ commons/proper/dbutils/trunk/src/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
Wed Mar 11 04:45:00 2009
@@ -32,20 +32,20 @@
     /**
      * The column number to retrieve.
      */
-    private int columnIndex = 1;
+    private final int columnIndex;
 
     /**
      * The column name to retrieve.  Either columnName or columnIndex
      * will be used but never both.
      */
-    private String columnName = null;
+    private final String columnName;
 
     /** 
      * Creates a new instance of ScalarHandler.  The first column will
      * be returned from <code>handle()</code>.
      */
     public ScalarHandler() {
-        super();
+        this(1, null);
     }
 
     /** 
@@ -55,7 +55,7 @@
      * <code>ResultSet</code>.
      */
     public ScalarHandler(int columnIndex) {
-        this.columnIndex = columnIndex;
+        this(columnIndex, null);
     }
 
     /** 
@@ -65,7 +65,13 @@
      * <code>ResultSet</code>.
      */
     public ScalarHandler(String columnName) {
-        this.columnName = columnName;
+        this(1, columnName);
+    }
+
+    // Helper constructor
+    private ScalarHandler(int columnIndex, String columnName){
+        this.columnIndex = columnIndex;
+        this.columnName = columnName;        
     }
 
     /**



Mime
View raw message