Author: skitching
Date: Sun Mar  6 19:26:56 2005
New Revision: 156383

URL: http://svn.apache.org/viewcvs?view=rev&rev=156383
Log:
Code tidyups without any functionality change:
 * Added constructors; it is cleaner for an abstract class
   to initialise its own members than require its subclasses
   to initialise them.
 * Made protected strings member final. Theoretically this is
   a "breaking API change". However only a complete nutter would
   ever write a class that would modify this member; the results
   would be very odd!

Modified:
    
jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java

Modified: 
jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java?view=diff&r1=156382&r2=156383
==============================================================================
--- 
jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java
 (original)
+++ 
jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/converters/AbstractArrayConverter.java
 Sun Mar  6 19:26:56 2005
@@ -50,19 +50,46 @@
 public abstract class AbstractArrayConverter implements Converter {
 
 
-    // ----------------------------------------------------- Instance Variables
+    // ----------------------------------------------------------- Constructors
 
 
     /**
-     * The default value specified to our Constructor, if any.
+     * Create a [EMAIL PROTECTED] Converter} that will throw a [EMAIL 
PROTECTED] ConversionException}
+     * if a conversion error occurs.
      */
-    protected Object defaultValue = null;
+    public AbstractArrayConverter() {
+
+        this.defaultValue = null;
+        this.useDefault = false;
+
+    }
+
+    /**
+     * Create a [EMAIL PROTECTED] Converter} that will return the specified 
default value
+     * if a conversion error occurs.
+     *
+     * @param defaultValue The default value to be returned
+     */
+    public AbstractArrayConverter(Object defaultValue) {
+
+        this.defaultValue = defaultValue;
+        this.useDefault = true;
+
+    }
+
+    // ----------------------------------------------------- Instance Variables
 
 
     /**
      * <p>Model object for string arrays.</p>
      */
-    protected static String strings[] = new String[0];
+    protected static final String strings[] = new String[0];
+
+
+    /**
+     * The default value specified to our Constructor, if any.
+     */
+    protected Object defaultValue = null;
 
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to