You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dg...@apache.org on 2003/05/24 21:17:57 UTC

cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator ValidatorResources.java ValidatorAction.java

dgraham     2003/05/24 12:17:57

  Modified:    validator/src/share/org/apache/commons/validator
                        ValidatorResources.java ValidatorAction.java
  Log:
  Moved ValidatorAction.process() functionality to setter methods so we 
  don't need to call process() to fully initialize the object.
  
  Revision  Changes    Path
  1.18      +4 -5      jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResources.java
  
  Index: ValidatorResources.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResources.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ValidatorResources.java	22 May 2003 03:28:05 -0000	1.17
  +++ ValidatorResources.java	24 May 2003 19:17:57 -0000	1.18
  @@ -280,7 +280,6 @@
               && va.getMethod().length() > 0) {
   
               va.init();
  -            va.process(hConstants);
   
               hActions.put(va.getName(), va);
   
  
  
  
  1.12      +29 -28    jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorAction.java
  
  Index: ValidatorAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorAction.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ValidatorAction.java	24 May 2003 19:07:36 -0000	1.11
  +++ ValidatorAction.java	24 May 2003 19:17:57 -0000	1.12
  @@ -174,7 +174,8 @@
   	private List dependencyList = Collections.synchronizedList(new ArrayList());
   
   	/**
  -	 * A list of all the validation method's parameters.
  +	 * An internal List representation of all the validation method's parameters defined 
  +     * in the methodParams String.
   	 */
   	private List methodParameterList = new ArrayList();
   
  @@ -229,27 +230,41 @@
   
   	/**
   	 * Sets the method parameters for the method.
  +     * @param methodParams A comma separated list of parameters.
   	 */
   	public void setMethodParams(String methodParams) {
  -		this.methodParams = methodParams;
  -	}
  +        this.methodParams = methodParams;
  +
  +        this.methodParameterList.clear();
  +
  +        StringTokenizer st = new StringTokenizer(methodParams, ",");
  +        while (st.hasMoreTokens()) {
  +            String value = st.nextToken().trim();
  +
  +            if (value != null && value.length() > 0) {
  +                this.methodParameterList.add(value);
  +            }
  +        }
  +    }
   
   	/**
  -	 * Gets the method parameters for the method.
  +	 * Gets the method parameters for the method as an unmodifiable List.
   	 */
   	public List getMethodParamsList() {
  -		return Collections.unmodifiableList(methodParameterList);
  +		return Collections.unmodifiableList(this.methodParameterList);
   	}
   
   	/**
  -	 * Gets the dependencies of the validator action.
  +	 * Gets the dependencies of the validator action as a comma separated list of 
  +     * validator names.
   	 */
   	public String getDepends() {
  -		return depends;
  +		return this.depends;
   	}
   
   	/**
   	 * Sets the dependencies of the validator action.
  +     * @param depends A comma separated list of validator names.
   	 */
       public void setDepends(String depends) {
           this.depends = depends;
  @@ -492,25 +507,11 @@
   	/**
   	 * Creates a <code>FastHashMap</code> for the isDependency method 
   	 * based on depends.
  +     * @deprecated This functionality has been moved to other methods.  It's no longer
  +     * required to call this method to initialize this object.
   	 */
   	public synchronized void process(Map globalConstants) {
  -
  -		// Create List for methodParams
  -		if (getMethodParams() != null) {
  -			if (methodParameterList == null) {
  -				methodParameterList = new ArrayList();
  -			}
  -
  -			StringTokenizer st = new StringTokenizer(getMethodParams(), ",");
  -
  -			while (st.hasMoreTokens()) {
  -				String value = st.nextToken().trim();
  -
  -				if (value != null && value.length() > 0) {
  -					methodParameterList.add(value);
  -				}
  -			}
  -		}
  +        // do nothing
   	}
   
   	/**
  
  
  

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