commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator FormSet.java
Date Tue, 29 Apr 2003 02:33:17 GMT
dgraham     2003/04/28 19:33:17

  Modified:    validator/src/share/org/apache/commons/validator
                        FormSet.java
  Log:
  Minor documentation changes and field renames.
  
  Revision  Changes    Path
  1.7       +44 -49    jakarta-commons/validator/src/share/org/apache/commons/validator/FormSet.java
  
  Index: FormSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/FormSet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FormSet.java	30 Mar 2002 04:33:17 -0000	1.6
  +++ FormSet.java	29 Apr 2003 02:33:17 -0000	1.7
  @@ -7,7 +7,7 @@
    *
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -76,23 +76,23 @@
    *
    * @author David Winterfeldt
    * @version $Revision$ $Date$
  -*/
  + */
   public class FormSet implements Serializable {
       
       /**
        * Whether or not the this <code>FormSet</code> was processed 
        * for replacing variables in strings with their values.
  -    */
  -    private boolean bProcessed = false;
  +     */
  +    private boolean processed = false;
   
       /**
        * Language component of <code>Locale</code> (required).
  -    */
  +     */
       private String language = null;
       
       /**
        * Country component of <code>Locale</code> (optional).
  -    */
  +     */
       private String country = null;
   
       /**
  @@ -103,33 +103,33 @@
       /**
        * A <code>FastHashMap</code> of <code>Form</code>s 
        * using the name field of the <code>Form</code> as the key.
  -    */
  -    private FastHashMap hForms = new FastHashMap();
  +     */
  +    private FastHashMap forms = new FastHashMap();
   
       /**
        * A <code>FastHashMap</code> of <code>Constant</code>s 
        * using the name field of the <code>Constant</code> as the key.
  -    */
  -    private FastHashMap hConstants = new FastHashMap();
  +     */
  +    private FastHashMap constants = new FastHashMap();
   
       /**
        * Whether or not the this <code>FormSet</code> was processed 
        * for replacing variables in strings with their values.
  -    */    
  +     */    
       public boolean isProcessed() {
  -       return bProcessed;	
  +       return processed;	
       }
   
       /**
        * Gets the equivalent of the language component of <code>Locale</code>.
  -    */
  +     */
       public String getLanguage() {
          return language;	
       }
   
       /**
        * Sets the equivalent of the language component of <code>Locale</code>.
  -    */
  +     */
       public void setLanguage(String language) {
          this.language = language;	
       }
  @@ -143,93 +143,88 @@
   
       /**
        * Sets the equivalent of the country component of <code>Locale</code>.
  -    */
  +     */
       public void setCountry(String country) {
          this.country = country;	
       }
   
       /**
        * Gets the equivalent of the variant component of <code>Locale</code>.
  -    */
  +     */
       public String getVariant() {
          return variant;	
       }
   
       /**
        * Sets the equivalent of the variant component of <code>Locale</code>.
  -    */
  +     */
       public void setVariant(String variant) {
          this.variant = variant;	
       }
   
       /**
        * Add a <code>Constant</code> (locale level).
  -    */
  +     */
       public void addConstant(Constant c) {
          if (c.getName() != null && c.getName().length() > 0 &&
              c.getValue() != null && c.getValue().length() > 0) {
  -          hConstants.put(c.getName(), c.getValue());
  +               
  +          constants.put(c.getName(), c.getValue());
          }
       }
   
       /**
        * Add a <code>Constant</code> to the locale level.
  -    */
  +     */
       public void addConstantParam(String name, String value) {
          if (name != null && name.length() > 0 &&
              value != null && value.length() > 0) {
  -          hConstants.put(name, value);
  +               
  +          constants.put(name, value);
          }
       }
      
       /**
        * Add a <code>Form</code> to the <code>FormSet</code>.
  -    */    
  +     */    
       public void addForm(Form f) {
  -       hForms.put(f.getName(), f);
  +       forms.put(f.getName(), f);
       }
   
       /**
        * Retrieve a <code>Form</code> based on the form name.
  -    */
  +     */
       public Form getForm(Object key) {
  -    	Form f = null;
  -    	Object o = hForms.get(key);
  -    	
  -    	if (o != null) {
  -    	   f = (Form)o;
  -    	}
  -    	
  -    	return f;
  +		return (Form) forms.get(key);
       }
       
       /**
        * A <code>Map</code> of <code>Form</code>s is returned as
an 
        * unmodifiable <code>Map</code> with the key based on the form name.
  -    */
  +     */
       public Map getForms() {
  -    	return Collections.unmodifiableMap(hForms);
  +    	return Collections.unmodifiableMap(forms);
       }
       
       /**
        * Processes all of the <code>Form</code>s, set <code>FastHashMap</code>s

        * to 'fast' mode.
  -    */
  +     */
       public synchronized void process(Map globalConstants) {
  -       for (Iterator i = hForms.values().iterator(); i.hasNext(); ) {
  -       	  Form f = (Form)i.next();
  -       	  f.process(globalConstants, hConstants);
  -       }
  -       
  -       hForms.setFast(true);
  -       hConstants.setFast(true);
  -       
  -       bProcessed = true;
  +    	for (Iterator i = forms.values().iterator(); i.hasNext();) {
  +    		Form f = (Form) i.next();
  +    		f.process(globalConstants, constants);
  +    	}
  +    
  +    	forms.setFast(true);
  +    	constants.setFast(true);
  +    
  +    	processed = true;
       }
   
       /**
        * Returns a string representation of the object.
  -    */    
  +     */    
       public String toString() {
          StringBuffer results = new StringBuffer();
       
  
  
  

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