org.apache.tools.ant.types
Class FilterSet

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.types.DataType
              |
              +--org.apache.tools.ant.types.FilterSet

public class FilterSet
extends DataType

A set of filters to be applied to something. A filter set may have begintoken and endtokens defined.

Author:
Michael McCallum

Inner Class Summary
static class FilterSet.Filter
          Individual filter component of filterset
 class FilterSet.FiltersFile
          The filtersfile nested element.
 
Field Summary
static java.lang.String DEFAULT_TOKEN_END
          The default token end string
static java.lang.String DEFAULT_TOKEN_START
          The default token start string
 
Fields inherited from class org.apache.tools.ant.types.DataType
checked, description, ref
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
  FilterSet()
           
protected FilterSet(FilterSet filterset)
          Create a Filterset from another filterset
 
Method Summary
 void addFilter(FilterSet.Filter filter)
          Create a new filter
 void addFilter(java.lang.String token, java.lang.String value)
          Add a new filter made from the given token and value.
 void addFilterSet(FilterSet filterSet)
          Add a Filterset to this filter set
 FilterSet.FiltersFile createFiltersfile()
          Create a new FiltersFile
 java.lang.String getBeginToken()
           
 java.lang.String getEndToken()
           
 java.util.Hashtable getFilterHash()
          Gets the filter hash of the FilterSet.
protected  java.util.Vector getFilters()
           
protected  FilterSet getRef()
           
 boolean hasFilters()
          Test to see if this filter set it empty.
 void readFiltersFromFile(java.io.File filtersFile)
          Read the filters from the given file.
 java.lang.String replaceTokens(java.lang.String line)
          Does replacement on the given string with token matching.
 void setBeginToken(java.lang.String startOfToken)
          The string used to id the beginning of a token.
 void setEndToken(java.lang.String endOfToken)
          The string used to id the end of a token.
 void setFiltersfile(java.io.File filtersFile)
          set the file containing the filters for this filterset.
 
Methods inherited from class org.apache.tools.ant.types.DataType
circularReference, dieOnCircularReference, getCheckedRef, getDescription, isReference, noChildrenAllowed, setDescription, setRefid, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, log, log, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TOKEN_START

public static final java.lang.String DEFAULT_TOKEN_START
The default token start string

DEFAULT_TOKEN_END

public static final java.lang.String DEFAULT_TOKEN_END
The default token end string
Constructor Detail

FilterSet

public FilterSet()

FilterSet

protected FilterSet(FilterSet filterset)
Create a Filterset from another filterset
Parameters:
filterset - the filterset upon which this filterset will be based.
Method Detail

getFilters

protected java.util.Vector getFilters()

getRef

protected FilterSet getRef()

getFilterHash

public java.util.Hashtable getFilterHash()
Gets the filter hash of the FilterSet.
Returns:
The hash of the tokens and values for quick lookup.

setFiltersfile

public void setFiltersfile(java.io.File filtersFile)
                    throws BuildException
set the file containing the filters for this filterset.
Parameters:
filtersFile - sets the filter fil to read filters for this filter set from.
Throws:
BuildException - if there is a problem reading the filters

setBeginToken

public void setBeginToken(java.lang.String startOfToken)
The string used to id the beginning of a token.
Parameters:
startOfToken - The new Begintoken value

getBeginToken

public java.lang.String getBeginToken()

setEndToken

public void setEndToken(java.lang.String endOfToken)
The string used to id the end of a token.
Parameters:
endOfToken - The new Endtoken value

getEndToken

public java.lang.String getEndToken()

readFiltersFromFile

public void readFiltersFromFile(java.io.File filtersFile)
                         throws BuildException
Read the filters from the given file.
Parameters:
filtersFile - the file from which filters are read
Throws:
BuildException - Throw a build exception when unable to read the file.

replaceTokens

public java.lang.String replaceTokens(java.lang.String line)
Does replacement on the given string with token matching. This uses the defined begintoken and endtoken values which default to @ for both.
Parameters:
line - The line to process the tokens in.
Returns:
The string with the tokens replaced.

addFilter

public void addFilter(FilterSet.Filter filter)
Create a new filter
Parameters:
the - filter to be added

createFiltersfile

public FilterSet.FiltersFile createFiltersfile()
Create a new FiltersFile
Returns:
The filter that was created.

addFilter

public void addFilter(java.lang.String token,
                      java.lang.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.

addFilterSet

public void addFilterSet(FilterSet filterSet)
Add a Filterset to this filter set
Parameters:
filterSet - the filterset to be added to this filterset

hasFilters

public boolean hasFilters()
Test to see if this filter set it empty.
Returns:
Return true if there are filter in this set otherwise false.


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.