FileDocCategorySizeDatePackage
AntFilterReader.javaAPI DocApache Ant 1.704651Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.types

AntFilterReader

public final class AntFilterReader extends DataType implements Cloneable
An AntFilterReader is a wrapper class that encloses the classname and configuration of a Configurable FilterReader.

Fields Summary
private String
className
private final Vector
parameters
private Path
classpath
Constructors Summary
Methods Summary
public voidaddParam(Parameter param)
Add a Parameter.

param
param a Parameter value

        parameters.addElement(param);
    
public PathcreateClasspath()
Set the classpath to load the FilterReader through (nested element).

return
a classpath to be configured

        if (isReference()) {
            throw noChildrenAllowed();
        }
        if (this.classpath == null) {
            this.classpath = new Path(getProject());
        }
        return this.classpath.createPath();
    
public java.lang.StringgetClassName()
Get the className attribute.

return
a String value

        return className;
    
public PathgetClasspath()
Get the classpath.

return
the classpath

        return classpath;
    
public Parameter[]getParams()
The parameters for this filter.

return
a Parameter[] value

        Parameter[] params = new Parameter[parameters.size()];
        parameters.copyInto(params);
        return params;
    
public voidsetClassName(java.lang.String className)
Set the className attribute.

param
className a String value


                  
         
        this.className = className;
    
public voidsetClasspath(Path classpath)
Set the classpath to load the FilterReader through (attribute).

param
classpath a classpath

        if (isReference()) {
            throw tooManyAttributes();
        }
        if (this.classpath == null) {
            this.classpath = classpath;
        } else {
            this.classpath.append(classpath);
        }
    
public voidsetClasspathRef(Reference r)
Set the classpath to load the FilterReader through via reference (attribute).

param
r a reference to a classpath

        if (isReference()) {
            throw tooManyAttributes();
        }
        createClasspath().setRefid(r);
    
public voidsetRefid(Reference r)
Makes this instance in effect a reference to another AntFilterReader instance.

You must not set another attribute or nest elements inside this element if you make it a reference.

param
r the reference to which this instance is associated
exception
BuildException if this instance already has been configured.

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