FileDocCategorySizeDatePackage
Filter.javaAPI DocApache Ant 1.703065Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.taskdefs

Filter

public class Filter extends org.apache.tools.ant.Task
Sets a token filter that is used by the file copy tasks to do token substitution. Sets multiple tokens by reading these from a file.
since
Ant 1.1
ant.task
category="filesystem"

Fields Summary
private String
token
private String
value
private File
filtersFile
Constructors Summary
Methods Summary
public voidexecute()
Execute the task.

throws
BuildException on error

        boolean isFiltersFromFile =
            filtersFile != null && token == null && value == null;
        boolean isSingleFilter =
            filtersFile == null && token != null && value != null;

        if (!isFiltersFromFile && !isSingleFilter) {
            throw new BuildException("both token and value parameters, or "
                                     + "only a filtersFile parameter is "
                                     + "required", getLocation());
        }

        if (isSingleFilter) {
            getProject().getGlobalFilterSet().addFilter(token, value);
        }

        if (isFiltersFromFile) {
            readFilters();
        }
    
protected voidreadFilters()
Read the filters.

throws
BuildException on error

        log("Reading filters from " + filtersFile, Project.MSG_VERBOSE);
        getProject().getGlobalFilterSet().readFiltersFromFile(filtersFile);
    
public voidsetFiltersfile(java.io.File filtersFile)
The file from which the filters must be read. This file must be a formatted as a property file.

param
filtersFile filter file

        this.filtersFile = filtersFile;
    
public voidsetToken(java.lang.String token)
The token string without @ delimiters.

param
token token to set

        this.token = token;
    
public voidsetValue(java.lang.String value)
The string that should replace the token during filtered copies.

param
value token replace value

        this.value = value;