Browse Source

Make AntFilterreader truly referenceable.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272477 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
28d74d5238
1 changed files with 35 additions and 0 deletions
  1. +35
    -0
      src/main/org/apache/tools/ant/types/AntFilterReader.java

+ 35
- 0
src/main/org/apache/tools/ant/types/AntFilterReader.java View File

@@ -53,6 +53,7 @@
*/ */
package org.apache.tools.ant.types; package org.apache.tools.ant.types;


import org.apache.tools.ant.BuildException;
import java.util.Vector; import java.util.Vector;


/** /**
@@ -133,4 +134,38 @@ public final class AntFilterReader
parameters.copyInto(params); parameters.copyInto(params);
return 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);
}
} }

Loading…
Cancel
Save