ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umag...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types AntFilterReader.java
Date Tue, 16 Apr 2002 20:47:24 GMT
umagesh     02/04/16 13:47:24

  Modified:    src/main/org/apache/tools/ant/types AntFilterReader.java
  Log:
  Make AntFilterreader truly referenceable.
  
  Revision  Changes    Path
  1.4       +35 -0     jakarta-ant/src/main/org/apache/tools/ant/types/AntFilterReader.java
  
  Index: AntFilterReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/AntFilterReader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AntFilterReader.java	12 Apr 2002 13:26:53 -0000	1.3
  +++ AntFilterReader.java	16 Apr 2002 20:47:23 -0000	1.4
  @@ -53,6 +53,7 @@
    */
   package org.apache.tools.ant.types;
   
  +import org.apache.tools.ant.BuildException;
   import java.util.Vector;
   
   /**
  @@ -132,5 +133,39 @@
           Parameter[] params = new Parameter[parameters.size()];
           parameters.copyInto(params);
           return params;
  +    }
  +
  +    /**
  +     * Makes this instance in effect a reference to another AntFilterReader instance
  +     *
  +     * <p>You must not set another attribute or nest elements inside
  +     * this element if you make it a reference.</p>
  +     *
  +     * @param r the reference to which this instance is associated
  +     * @exception BuildException if this instance already has been configured.
  +     */
  +    public void setRefid(Reference r) throws BuildException {
  +        if (!parameters.isEmpty() || className != null
  +                || classpath != null) {
  +            throw tooManyAttributes();
  +        }
  +        // change this to get the objects from the other reference
  +        Object o = r.getReferencedObject(getProject());
  +        if (o instanceof AntFilterReader) {
  +            AntFilterReader afr = (AntFilterReader) o;
  +            setClassName(afr.getClassName());
  +            setClasspath(afr.getClasspath());
  +            Parameter[] p = afr.getParams();
  +            if (p != null) {
  +                for (int i = 0; i < p.length; i++) {
  +                    addParam(p[i]);
  +                }
  +            }
  +        } else {
  +            String msg = r.getRefId() + " doesn\'t refer to a FilterReader";
  +            throw new BuildException(msg);
  +        }
  +
  +        super.setRefid(r);
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message