You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2003/04/01 13:25:26 UTC

cvs commit: ant/src/main/org/apache/tools/ant/types DataType.java

conor       2003/04/01 03:25:26

  Modified:    src/main/org/apache/tools/ant RuntimeConfigurable.java
               src/main/org/apache/tools/ant/types DataType.java
  Log:
  Small cleanup
  
  Revision  Changes    Path
  1.26      +26 -23    ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
  
  Index: RuntimeConfigurable.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -w -u -r1.25 -r1.26
  --- RuntimeConfigurable.java	7 Mar 2003 11:22:59 -0000	1.25
  +++ RuntimeConfigurable.java	1 Apr 2003 11:25:26 -0000	1.26
  @@ -61,9 +61,7 @@
   import java.io.Serializable;
   
   import org.xml.sax.AttributeList;
  -import org.xml.sax.Attributes;
   import org.xml.sax.helpers.AttributeListImpl;
  -import org.xml.sax.helpers.AttributesImpl;
   
   /**
    * Wrapper class that holds the attributes of an element, its children, and
  @@ -76,15 +74,19 @@
   
       /** Name of the element to configure. */
       private String elementTag = null;
  +    
       /** List of child element wrappers. */
       private Vector children = new Vector();
  +    
       /** The element to configure. It is only used during
        * maybeConfigure.
        */
       private transient Object wrappedObject = null;
   
  -    /** @@deprecated
  -     * XML attributes for the element. */
  +    /** 
  +     * @deprecated
  +     * XML attributes for the element. 
  +     */
       private transient AttributeList attributes;
   
       /** Attribute names and values. While the XML spec doesn't require
  @@ -93,12 +95,14 @@
        *  We could also just use SAX2 Attributes and convert to SAX1 ( DOM
        *  attribute Nodes can also be stored in SAX2 Attributges )
        */
  -    private Vector attNames=new Vector();
  -    private Vector attValues=new Vector();
  -    private Hashtable attMap=new Hashtable();
  +    private Vector attributeNames = new Vector();
  +    
  +    /** Map of attribute names to values */
  +    private Hashtable attributeMap = new Hashtable();
   
       /** Text appearing within the element. */
       private StringBuffer characters = new StringBuffer();
  +    
       /** Indicates if the wrapped object has been configured */
       private boolean proxyConfigured = false;
   
  @@ -114,9 +118,10 @@
           this.elementTag = elementTag;
           proxyConfigured = false;
           // Most likely an UnknownElement
  -        if( proxy instanceof Task )
  +        if (proxy instanceof Task) {
               ((Task)proxy).setRuntimeConfigurableWrapper( this );
       }
  +    }
   
       /**
        * Sets the element to configure.
  @@ -142,14 +147,13 @@
       public void setAttributes(AttributeList attributes) {
           this.attributes = new AttributeListImpl(attributes);
           for (int i = 0; i < attributes.getLength(); i++) {
  -            this.setAttribute( attributes.getName(i), attributes.getValue(i));
  +            setAttribute(attributes.getName(i), attributes.getValue(i));
           }
       }
   
       public void setAttribute( String name, String value ) {
  -        attNames.addElement( name );
  -        attValues.addElement( value );
  -        attMap.put( name, value );
  +        attributeNames.addElement(name);
  +        attributeMap.put(name, value);
       }
   
       /** Return the attribute map.
  @@ -157,7 +161,7 @@
        * @return Attribute name to attribute value map
        */
       public Hashtable getAttributeMap() {
  -        return attMap;
  +        return attributeMap;
       }
   
       /**
  @@ -286,8 +290,7 @@
        *            an element which doesn't accept it.
        */
       public void maybeConfigure(Project p, boolean configureChildren)
  -        throws BuildException
  -    {
  +        throws BuildException {
           String id = null;
   
           if (proxyConfigured) {
  @@ -302,9 +305,9 @@
           IntrospectionHelper ih =
               IntrospectionHelper.getHelper(p, target.getClass());
   
  -        for( int i=0; i< attNames.size(); i++ ) {
  -            String name=(String) attNames.elementAt(i);
  -            String value=(String) attValues.elementAt(i);
  +        for (int i = 0; i < attributeNames.size(); i++) {
  +            String name = (String) attributeNames.elementAt(i);
  +            String value = (String) attributeMap.get(name);
   
               // reflect these into the target
               value = p.replaceProperties(value);
  @@ -318,7 +321,7 @@
                   }
               }
           }
  -        id = (String)attMap.get("id");
  +        id = (String) attributeMap.get("id");
   
           if (characters.length() != 0) {
               ProjectHelper.addText(p, wrappedObject, characters.toString());
  
  
  
  1.12      +1 -1      ant/src/main/org/apache/tools/ant/types/DataType.java
  
  Index: DataType.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/DataType.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -u -r1.11 -r1.12
  --- DataType.java	7 Mar 2003 11:23:07 -0000	1.11
  +++ DataType.java	1 Apr 2003 11:25:26 -0000	1.12
  @@ -74,7 +74,7 @@
    */
   public abstract class DataType extends ProjectComponent {
       /**
  -     * The descriptin the user has set.
  +     * The description the user has set.
        *
        * @deprecated The user should not be directly referencing
        *   variable. Please use {@link #setDescription} or