Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 1034 invoked from network); 16 Feb 2005 14:38:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Feb 2005 14:38:44 -0000 Received: (qmail 8720 invoked by uid 500); 16 Feb 2005 14:38:41 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 8633 invoked by uid 500); 16 Feb 2005 14:38:41 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 8618 invoked by uid 500); 16 Feb 2005 14:38:41 -0000 Received: (qmail 8615 invoked by uid 99); 16 Feb 2005 14:38:41 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 16 Feb 2005 06:38:40 -0800 Received: (qmail 938 invoked by uid 65534); 16 Feb 2005 14:38:39 -0000 Message-ID: <20050216143839.934.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Wed, 16 Feb 2005 14:38:39 -0000 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 To: commons-cvs@jakarta.apache.org From: dgraham@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: dgraham Date: Wed Feb 16 06:38:37 2005 New Revision: 154021 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D154021 Log: Deprecated all FastHashMap usage and provided protected=20 get methods that return generic Maps to be used by subclasses. Removed: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/util/ValidatorUtils.java Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/Field.java jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/Form.java jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/ValidatorResources.java Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commo= ns/validator/Field.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/s= rc/share/org/apache/commons/validator/Field.java?view=3Ddiff&r1=3D154020&r2= =3D154021 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/Field.java (original) +++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/Field.java Wed Feb 16 06:38:37 2005 @@ -41,10 +41,10 @@ * message information and variables to perform the validations and genera= te=20 * error messages. Instances of this class are configured with a=20 * <field> xml element. - * + *

* The use of FastHashMap is deprecated and will be replaced in a future * release. - * + *

* @see org.apache.commons.validator.Form */ public class Field implements Cloneable, Serializable { @@ -87,8 +87,14 @@ */ private List dependencyList =3D Collections.synchronizedList(new Array= List()); =20 + /** + * @deprecated Subclasses should use getVarMap() instead.=20 + */ protected FastHashMap hVars =3D new FastHashMap(); - =20 + + /** + * @deprecated Subclasses should use getMsgMap() instead. + */ protected FastHashMap hMsgs =3D new FastHashMap(); =20 /** @@ -223,7 +229,7 @@ * @since Validator 1.1.4 */ public Msg getMessage(String key) { - return (Msg)hMsgs.get(key); + return (Msg) hMsgs.get(key); } =20 /** @@ -246,8 +252,7 @@ } =20 determineArgPosition(arg); - - this.ensureArgsCapacity(arg); + ensureArgsCapacity(arg); =20 Map argMap =3D this.args[arg.getPosition()]; if (argMap =3D=3D null) { @@ -796,11 +801,24 @@ * @throws ValidatorException */ private void handleMissingAction(String name) throws ValidatorExceptio= n { - 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; } =20 } Modified: jakarta/commons/proper/validator/trunk/src/share/org/apache/commo= ns/validator/Form.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/s= rc/share/org/apache/commons/validator/Form.java?view=3Ddiff&r1=3D154020&r2= =3D154021 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/Form.java (original) +++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/Form.java Wed Feb 16 06:38:37 2005 @@ -44,8 +44,7 @@ public class Form implements Serializable { =20 /** - * 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 =3D null; =20 @@ -59,6 +58,7 @@ =20 /** * Map of Fields keyed on their property value. + * @deprecated Subclasses should use getFieldMap() instead. */ protected FastHashMap hFields =3D new FastHashMap(); =20 @@ -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 =3D string; + public void setExtends(String inherit) { + this.inherit =3D inherit; } =20 /** @@ -238,5 +238,13 @@ */ public boolean isExtending() { return inherit !=3D 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/commo= ns/validator/ValidatorResources.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/s= rc/share/org/apache/commons/validator/ValidatorResources.java?view=3Ddiff&r= 1=3D154020&r2=3D154021 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/ValidatorResources.java (original) +++ jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/val= idator/ValidatorResources.java Wed Feb 16 06:38:37 2005 @@ -74,26 +74,26 @@ "/org/apache/commons/validator/resources/validator_1_2_0.dtd" }; =20 - /** - * Logger. - */ private static final Log log =3D LogFactory.getLog(ValidatorResources.= class); =20 /** - * FastHashMap of FormSets stored under + * Map of FormSets stored under * a Locale key. + * @deprecated Subclasses should use getFormSets() instead. */ protected FastHashMap hFormSets =3D new FastHashMap(); =20 /** - * FastHashMap of global constant values with + * Map of global constant values with * the name of the constant as the key. + * @deprecated Subclasses should use getConstants() instead. */ protected FastHashMap hConstants =3D new FastHashMap(); =20 /** - * FastHashMap of ValidatorActions with + * Map of ValidatorActions with * the name of the ValidatorAction as the key. + * @deprecated Subclasses should use getActions() instead. */ protected FastHashMap hActions =3D new FastHashMap(); =20 @@ -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(), loc= ale + .getVariant(), formKey); } =20 /** @@ -282,10 +279,7 @@ * * @since Validator 1.1 */ - public Form getForm( - String language, - String country, - String variant, + public Form getForm(String language, String country, String variant, String formKey) { =20 String key =3D this.buildLocale(language, country, variant); @@ -414,9 +408,7 @@ * constructing a clone, field by field, of partial * FormSet. */ - protected Field getClosestLocaleField( - FormSet fs, - String formKey, + protected Field getClosestLocaleField(FormSet fs, String formKey, String fieldKey) { =20 Field field =3D null; @@ -454,6 +446,30 @@ } =20 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 ValidatorAct= ion. + * @since Validator 1.2.0 + */ + protected Map getActions() { + return hActions; } =20 } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org