commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject svn commit: r154021 - in jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator: Field.java Form.java ValidatorResources.java util/ValidatorUtils.java
Date Wed, 16 Feb 2005 14:38:39 GMT
Author: dgraham
Date: Wed Feb 16 06:38:37 2005
New Revision: 154021

URL: http://svn.apache.org/viewcvs?view=rev&rev=154021
Log:
Deprecated all FastHashMap usage and provided protected 
get methods that return generic Maps to be used by subclasses.

Removed:
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/util/ValidatorUtils.java
Modified:
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java
    jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java?view=diff&r1=154020&r2=154021
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
(original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Field.java
Wed Feb 16 06:38:37 2005
@@ -41,10 +41,10 @@
  * message information and variables to perform the validations and generate 
  * error messages.  Instances of this class are configured with a 
  * <field> xml element.
- *
+ * <p>
  * The use of FastHashMap is deprecated and will be replaced in a future
  * release.
- *
+ * </p>
  * @see org.apache.commons.validator.Form
  */
 public class Field implements Cloneable, Serializable {
@@ -87,8 +87,14 @@
      */
     private List dependencyList = Collections.synchronizedList(new ArrayList());
 
+    /**
+     * @deprecated Subclasses should use getVarMap() instead. 
+     */
     protected FastHashMap hVars = new FastHashMap();
-    
+
+    /**
+     * @deprecated Subclasses should use getMsgMap() instead.
+     */
     protected FastHashMap hMsgs = new FastHashMap();
 
     /**
@@ -223,7 +229,7 @@
      * @since Validator 1.1.4
      */
     public Msg getMessage(String key) {
-        return (Msg)hMsgs.get(key);
+        return (Msg) hMsgs.get(key);
     }
 
     /**
@@ -246,8 +252,7 @@
         }
 
         determineArgPosition(arg);
-
-        this.ensureArgsCapacity(arg);
+        ensureArgsCapacity(arg);
 
         Map argMap = this.args[arg.getPosition()];
         if (argMap == null) {
@@ -796,11 +801,24 @@
      * @throws ValidatorException
      */
     private void handleMissingAction(String name) throws ValidatorException {
-        throw new ValidatorException(
-            "No ValidatorAction named "
-                + name
-                + " found for field "
-                + this.getProperty());
+        throw new ValidatorException("No ValidatorAction named " + name
+                + " found for field " + this.getProperty());
+    }
+
+    /**
+     * Returns a Map of String Msg names to Msg objects.
+     * @since Validator 1.2.0
+     */
+    protected Map getMsgMap() {
+        return hMsgs;
+    }
+
+    /**
+     * Returns a Map of String Var names to Var objects.
+     * @since Validator 1.2.0
+     */
+    protected Map getVarMap() {
+        return hVars;
     }
 
 }

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java?view=diff&r1=154020&r2=154021
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java
(original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/Form.java
Wed Feb 16 06:38:37 2005
@@ -44,8 +44,7 @@
 public class Form implements Serializable {
 
     /**
-     * The name/key the set of validation rules is
-     * stored under.
+     * The name/key the set of validation rules is stored under.
      */
     protected String name = null;
 
@@ -59,6 +58,7 @@
 
     /**
      * Map of <code>Field</code>s keyed on their property value.
+     * @deprecated Subclasses should use getFieldMap() instead.
      */
     protected FastHashMap hFields = new FastHashMap();
 
@@ -228,8 +228,8 @@
      * Sets the name/key of the parent set of validation rules.
      * @since Validator 1.2.0
      */
-    public void setExtends(String string) {
-        inherit = string;
+    public void setExtends(String inherit) {
+        this.inherit = inherit;
     }
 
     /**
@@ -238,5 +238,13 @@
      */
     public boolean isExtending() {
         return inherit != null;
+    }
+
+    /**
+     * Returns a Map of String field keys to Field objects.
+     * @since Validator 1.2.0
+     */
+    protected Map getFieldMap() {
+        return hFields;
     }
 }

Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java?view=diff&r1=154020&r2=154021
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java
(original)
+++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/ValidatorResources.java
Wed Feb 16 06:38:37 2005
@@ -74,26 +74,26 @@
         "/org/apache/commons/validator/resources/validator_1_2_0.dtd"
     };
 
-    /**
-     * Logger.
-     */
     private static final Log log = LogFactory.getLog(ValidatorResources.class);
 
     /**
-     * <code>FastHashMap</code> of <code>FormSet</code>s stored under
+     * <code>Map</code> of <code>FormSet</code>s stored under
      * a <code>Locale</code> key.
+     * @deprecated Subclasses should use getFormSets() instead.
      */
     protected FastHashMap hFormSets = new FastHashMap();
 
     /**
-     * <code>FastHashMap</code> of global constant values with
+     * <code>Map</code> of global constant values with
      * the name of the constant as the key.
+     * @deprecated Subclasses should use getConstants() instead.
      */
     protected FastHashMap hConstants = new FastHashMap();
 
     /**
-     * <code>FastHashMap</code> of <code>ValidatorAction</code>s
with
+     * <code>Map</code> of <code>ValidatorAction</code>s with
      * the name of the <code>ValidatorAction</code> as the key.
+     * @deprecated Subclasses should use getActions() instead.
      */
     protected FastHashMap hActions = new FastHashMap();
 
@@ -263,11 +263,8 @@
      * @since Validator 1.1
      */
     public Form getForm(Locale locale, String formKey) {
-        return this.getForm(
-                locale.getLanguage(),
-                locale.getCountry(),
-                locale.getVariant(),
-                formKey);
+        return this.getForm(locale.getLanguage(), locale.getCountry(), locale
+                .getVariant(), formKey);
     }
 
     /**
@@ -282,10 +279,7 @@
      * </ol>
      * @since Validator 1.1
      */
-    public Form getForm(
-            String language,
-            String country,
-            String variant,
+    public Form getForm(String language, String country, String variant,
             String formKey) {
 
         String key = this.buildLocale(language, country, variant);
@@ -414,9 +408,7 @@
      * constructing a clone, field by field, of partial
      * <code>FormSet</code>.
      */
-    protected Field getClosestLocaleField(
-            FormSet fs,
-            String formKey,
+    protected Field getClosestLocaleField(FormSet fs, String formKey,
             String fieldKey) {
 
         Field field = null;
@@ -454,6 +446,30 @@
         }
 
         return field;
+    }
+
+    /**
+     * Returns a Map of String locale keys to Lists of their FormSets.
+     * @since Validator 1.2.0
+     */
+    protected Map getFormSets() {
+        return hFormSets;
+    }
+
+    /**
+     * Returns a Map of String constant names to their String values.
+     * @since Validator 1.2.0
+     */
+    protected Map getConstants() {
+        return hConstants;
+    }
+
+    /**
+     * Returns a Map of String ValidatorAction names to their ValidatorAction.
+     * @since Validator 1.2.0
+     */
+    protected Map getActions() {
+        return hActions;
     }
 
 }



---------------------------------------------------------------------
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