umagesh 02/02/23 17:56:58
Modified:
proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/types
AntFilterReader.java
Log:
Stefan's prediction coming true: AntFilterReader has its own classpath
attribute and nested classpath element.
Revision Changes Path
1.3 +52 -12
jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/types/AntFilterReader.java
Index: AntFilterReader.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/sandbox/filterreaders/src/main/org/apache/tools/ant/types/AntFilterReader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AntFilterReader.java 16 Feb 2002 02:29:34 -0000 1.2
+++ AntFilterReader.java 24 Feb 2002 01:56:58 -0000 1.3
@@ -58,6 +58,7 @@
import java.util.Vector;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
/**
* An AntFileReader is a wrapper class that encloses the classname
@@ -65,24 +66,18 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Magesh Umasankar</a>
*/
-public final class AntFilterReader {
+public final class AntFilterReader
+ extends DataType
+ implements Cloneable {
private String className;
private final Vector parameters = new Vector();
+ private Path classpath;
+
public final void setClassName(final String className) {
- try {
- final Class c = Class.forName(className);
- if (FilterReader.class.isAssignableFrom(c)) {
- this.className = className;
- } else {
- throw new BuildException(className +
- " does not extend java.io.FilterReader");
- }
- } catch (final ClassNotFoundException cnfe) {
- throw new BuildException(cnfe);
- }
+ this.className = className;
}
public final String getClassName() {
@@ -91,6 +86,51 @@
public final void addParam(final Parameter param) {
parameters.addElement(param);
+ }
+
+ /**
+ * Set the classpath to load the FilterReader through (attribute).
+ */
+ public final void setClasspath(Path classpath) {
+ if (isReference()) {
+ throw tooManyAttributes();
+ }
+ if (this.classpath == null) {
+ this.classpath = classpath;
+ } else {
+ this.classpath.append(classpath);
+ }
+ }
+
+ /**
+ * Set the classpath to load the FilterReader through (nested element).
+ */
+ public final Path createClasspath() {
+ if (isReference()) {
+ throw noChildrenAllowed();
+ }
+ if (this.classpath == null) {
+ this.classpath = new Path(getProject());
+ }
+ return this.classpath.createPath();
+ }
+
+ /**
+ * Get the classpath
+ */
+ public final Path getClasspath() {
+ return classpath;
+ }
+
+ /**
+ * Set the classpath to load the FilterReader through via
+ * reference (attribute).
+ */
+ public void setClasspathRef(Reference r) {
+ if (isReference()) {
+ throw tooManyAttributes();
+ }
+ createClasspath().setRefid(r);
}
public final Parameter[] getParams() {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>