org.apache.tools.ant.types

Class FilterSet

public class FilterSet extends DataType implements Cloneable

A set of filters to be applied to something. A filter set may have begintoken and endtokens defined.
Nested Class Summary
static classFilterSet.Filter
Individual filter component of filterset.
classFilterSet.FiltersFile
The filtersfile nested element.
Field Summary
static StringDEFAULT_TOKEN_END
The default token end string
static StringDEFAULT_TOKEN_START
The default token start string
Constructor Summary
FilterSet()
Default constructor.
protected FilterSet(FilterSet filterset)
Create a Filterset from another filterset.
Method Summary
voidaddConfiguredFilterSet(FilterSet filterSet)
Add a Filterset to this filter set.
voidaddFilter(FilterSet.Filter filter)
Add a new filter.
voidaddFilter(String token, String value)
Add a new filter made from the given token and value.
Objectclone()
Clone the filterset.
FilterSet.FiltersFilecreateFiltersfile()
Create a new FiltersFile.
StringgetBeginToken()
Get the begin token for this filterset.
StringgetEndToken()
Get the end token for this filterset.
HashtablegetFilterHash()
Gets the filter hash of the FilterSet.
protected VectorgetFilters()
Get the filters in the filter set.
protected FilterSetgetRef()
Get the referenced filter set.
booleanhasFilters()
Test to see if this filter set has filters.
booleanisRecurse()
Get whether recursive token expansion is enabled.
voidreadFiltersFromFile(File filtersFile)
Read the filters from the given file.
StringreplaceTokens(String line)
Does replacement on the given string with token matching.
voidsetBeginToken(String startOfToken)
Set the string used to id the beginning of a token.
voidsetEndToken(String endOfToken)
Set the string used to id the end of a token.
voidsetFiltersfile(File filtersFile)
Set the file containing the filters for this filterset.
voidsetRecurse(boolean recurse)
Set whether recursive token expansion is enabled.

Field Detail

DEFAULT_TOKEN_END

public static final String DEFAULT_TOKEN_END
The default token end string

DEFAULT_TOKEN_START

public static final String DEFAULT_TOKEN_START
The default token start string

Constructor Detail

FilterSet

public FilterSet()
Default constructor.

FilterSet

protected FilterSet(FilterSet filterset)
Create a Filterset from another filterset.

Parameters: filterset the filterset upon which this filterset will be based.

Method Detail

addConfiguredFilterSet

public void addConfiguredFilterSet(FilterSet filterSet)
Add a Filterset to this filter set.

Parameters: filterSet the filterset to be added to this filterset

addFilter

public void addFilter(FilterSet.Filter filter)
Add a new filter.

Parameters: filter the filter to be added.

addFilter

public void addFilter(String token, String value)
Add a new filter made from the given token and value.

Parameters: token The token for the new filter. value The value for the new filter.

clone

public Object clone()
Clone the filterset.

Returns: a deep clone of this filterset.

Throws: BuildException if the clone cannot be performed.

createFiltersfile

public FilterSet.FiltersFile createFiltersfile()
Create a new FiltersFile.

Returns: The filtersfile that was created.

getBeginToken

public String getBeginToken()
Get the begin token for this filterset.

Returns: the filter set's begin token for filtering.

getEndToken

public String getEndToken()
Get the end token for this filterset.

Returns: the filter set's end token for replacement delimiting.

getFilterHash

public Hashtable getFilterHash()
Gets the filter hash of the FilterSet.

Returns: The hash of the tokens and values for quick lookup.

getFilters

protected Vector getFilters()
Get the filters in the filter set.

Returns: a Vector of Filter instances.

getRef

protected FilterSet getRef()
Get the referenced filter set.

Returns: the filterset from the reference.

hasFilters

public boolean hasFilters()
Test to see if this filter set has filters.

Returns: Return true if there are filters in this set.

isRecurse

public boolean isRecurse()
Get whether recursive token expansion is enabled.

Returns: boolean whether enabled.

readFiltersFromFile

public void readFiltersFromFile(File filtersFile)
Read the filters from the given file.

Parameters: filtersFile the file from which filters are read.

Throws: BuildException when the file cannot be read.

replaceTokens

public String replaceTokens(String line)
Does replacement on the given string with token matching. This uses the defined begintoken and endtoken values which default to @ for both. This resets the passedTokens and calls iReplaceTokens to do the actual replacements.

Parameters: line The line in which to process embedded tokens.

Returns: The input string after token replacement.

setBeginToken

public void setBeginToken(String startOfToken)
Set the string used to id the beginning of a token.

Parameters: startOfToken The new Begintoken value.

setEndToken

public void setEndToken(String endOfToken)
Set the string used to id the end of a token.

Parameters: endOfToken The new Endtoken value.

setFiltersfile

public void setFiltersfile(File filtersFile)
Set the file containing the filters for this filterset.

Parameters: filtersFile sets the filter file from which to read filters for this filter set.

Throws: BuildException if there is a problem reading the filters.

setRecurse

public void setRecurse(boolean recurse)
Set whether recursive token expansion is enabled.

Parameters: recurse boolean whether to recurse.

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.