Search in sources :

Example 1 with ContainerMapper

use of org.apache.tools.ant.util.ContainerMapper in project ant by apache.

the class Mapper method add.

/**
 * Add a nested <code>FileNameMapper</code>.
 * @param fileNameMapper   the <code>FileNameMapper</code> to add.
 */
public void add(FileNameMapper fileNameMapper) {
    if (isReference()) {
        throw noChildrenAllowed();
    }
    if (container == null) {
        if (type == null && classname == null) {
            container = new CompositeMapper();
        } else {
            FileNameMapper m = getImplementation();
            if (m instanceof ContainerMapper) {
                container = (ContainerMapper) m;
            } else {
                throw new BuildException(String.valueOf(m) + " mapper implementation does not support nested mappers!");
            }
        }
    }
    container.add(fileNameMapper);
    setChecked(false);
}
Also used : CompositeMapper(org.apache.tools.ant.util.CompositeMapper) FileNameMapper(org.apache.tools.ant.util.FileNameMapper) BuildException(org.apache.tools.ant.BuildException) ContainerMapper(org.apache.tools.ant.util.ContainerMapper)

Aggregations

BuildException (org.apache.tools.ant.BuildException)1 CompositeMapper (org.apache.tools.ant.util.CompositeMapper)1 ContainerMapper (org.apache.tools.ant.util.ContainerMapper)1 FileNameMapper (org.apache.tools.ant.util.FileNameMapper)1