org.apache.tools.ant.taskdefs

Class MatchingTask

public abstract class MatchingTask extends Task implements SelectorContainer

This is an abstract task that should be used by all those tasks that require to include or exclude files based on pattern matching.

Since: Ant 1.1

Field Summary
protected FileSetfileset
Method Summary
voidadd(FileSelector selector)
add an arbitary selector
voidaddAnd(AndSelector selector)
add an "And" selector entry on the selector list
voidaddContains(ContainsSelector selector)
add a contains selector entry on the selector list
voidaddContainsRegexp(ContainsRegexpSelector selector)
add a regular expression selector entry on the selector list
voidaddCustom(ExtendSelector selector)
add an extended selector entry on the selector list
voidaddDate(DateSelector selector)
add a selector date entry on the selector list
voidaddDepend(DependSelector selector)
add a depends selector entry on the selector list
voidaddDepth(DepthSelector selector)
add a depth selector entry on the selector list
voidaddDifferent(DifferentSelector selector)
add a type selector entry on the type list
voidaddFilename(FilenameSelector selector)
add a selector filename entry on the selector list
voidaddMajority(MajoritySelector selector)
add a majority selector entry on the selector list
voidaddModified(ModifiedSelector selector)
add the modified selector
voidaddNone(NoneSelector selector)
add a "None" selector entry on the selector list
voidaddNot(NotSelector selector)
add a "Not" selector entry on the selector list
voidaddOr(OrSelector selector)
add an "Or" selector entry on the selector list
voidaddPresent(PresentSelector selector)
add a present selector entry on the selector list
voidaddSelector(SelectSelector selector)
add a "Select" selector entry on the selector list
voidaddSize(SizeSelector selector)
add a selector size entry on the selector list
voidaddType(TypeSelector selector)
add a type selector entry on the type list
voidappendSelector(FileSelector selector)
Add a new selector into this container.
PatternSet.NameEntrycreateExclude()
add a name entry on the exclude list
PatternSet.NameEntrycreateExcludesFile()
add a name entry on the include files list
PatternSet.NameEntrycreateInclude()
add a name entry on the include list
PatternSet.NameEntrycreateIncludesFile()
add a name entry on the include files list
PatternSetcreatePatternSet()
add a set of patterns
protected DirectoryScannergetDirectoryScanner(File baseDir)
Returns the directory scanner needed to access the files to process.
protected FileSetgetImplicitFileSet()
Accessor for the implicit fileset.
FileSelector[]getSelectors(Project p)
Returns the set of selectors as an array.
booleanhasSelectors()
Indicates whether there are any selectors here.
intselectorCount()
Gives the count of the number of selectors in this container
EnumerationselectorElements()
Returns an enumerator for accessing the set of selectors.
voidsetCaseSensitive(boolean isCaseSensitive)
Sets case sensitivity of the file system
voidsetDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.
voidsetExcludes(String excludes)
Sets the set of exclude patterns.
voidsetExcludesfile(File excludesfile)
Sets the name of the file containing the includes patterns.
voidsetFollowSymlinks(boolean followSymlinks)
Sets whether or not symbolic links should be followed.
voidsetIncludes(String includes)
Sets the set of include patterns.
voidsetIncludesfile(File includesfile)
Sets the name of the file containing the includes patterns.
voidsetProject(Project project)
{@inheritDoc}.
voidXsetIgnore(String ignoreString)
List of filenames and directory names to not include.
voidXsetItems(String itemString)
Set this to be the items in the base directory that you want to be included.

Field Detail

fileset

protected FileSet fileset

Method Detail

add

public void add(FileSelector selector)
add an arbitary selector

Parameters: selector the selector to add

Since: Ant 1.6

addAnd

public void addAnd(AndSelector selector)
add an "And" selector entry on the selector list

Parameters: selector the selector to add

addContains

public void addContains(ContainsSelector selector)
add a contains selector entry on the selector list

Parameters: selector the selector to add

addContainsRegexp

public void addContainsRegexp(ContainsRegexpSelector selector)
add a regular expression selector entry on the selector list

Parameters: selector the selector to add

addCustom

public void addCustom(ExtendSelector selector)
add an extended selector entry on the selector list

Parameters: selector the selector to add

addDate

public void addDate(DateSelector selector)
add a selector date entry on the selector list

Parameters: selector the selector to add

addDepend

public void addDepend(DependSelector selector)
add a depends selector entry on the selector list

Parameters: selector the selector to add

addDepth

public void addDepth(DepthSelector selector)
add a depth selector entry on the selector list

Parameters: selector the selector to add

addDifferent

public void addDifferent(DifferentSelector selector)
add a type selector entry on the type list

Parameters: selector the selector to add

Since: ant 1.6

addFilename

public void addFilename(FilenameSelector selector)
add a selector filename entry on the selector list

Parameters: selector the selector to add

addMajority

public void addMajority(MajoritySelector selector)
add a majority selector entry on the selector list

Parameters: selector the selector to add

addModified

public void addModified(ModifiedSelector selector)
add the modified selector

Parameters: selector the selector to add

Since: ant 1.6

addNone

public void addNone(NoneSelector selector)
add a "None" selector entry on the selector list

Parameters: selector the selector to add

addNot

public void addNot(NotSelector selector)
add a "Not" selector entry on the selector list

Parameters: selector the selector to add

addOr

public void addOr(OrSelector selector)
add an "Or" selector entry on the selector list

Parameters: selector the selector to add

addPresent

public void addPresent(PresentSelector selector)
add a present selector entry on the selector list

Parameters: selector the selector to add

addSelector

public void addSelector(SelectSelector selector)
add a "Select" selector entry on the selector list

Parameters: selector the selector to add

addSize

public void addSize(SizeSelector selector)
add a selector size entry on the selector list

Parameters: selector the selector to add

addType

public void addType(TypeSelector selector)
add a type selector entry on the type list

Parameters: selector the selector to add

Since: ant 1.6

appendSelector

public void appendSelector(FileSelector selector)
Add a new selector into this container.

Parameters: selector the new selector to add

createExclude

public PatternSet.NameEntry createExclude()
add a name entry on the exclude list

Returns: an NameEntry object to be configured

createExcludesFile

public PatternSet.NameEntry createExcludesFile()
add a name entry on the include files list

Returns: an NameEntry object to be configured

createInclude

public PatternSet.NameEntry createInclude()
add a name entry on the include list

Returns: a NameEntry object to be configured

createIncludesFile

public PatternSet.NameEntry createIncludesFile()
add a name entry on the include files list

Returns: an NameEntry object to be configured

createPatternSet

public PatternSet createPatternSet()
add a set of patterns

Returns: PatternSet object to be configured

getDirectoryScanner

protected DirectoryScanner getDirectoryScanner(File baseDir)
Returns the directory scanner needed to access the files to process.

Parameters: baseDir the base directory to use with the fileset

Returns: a directory scanner

getImplicitFileSet

protected final FileSet getImplicitFileSet()
Accessor for the implicit fileset.

Returns: the implicit fileset

Since: Ant 1.5.2

getSelectors

public FileSelector[] getSelectors(Project p)
Returns the set of selectors as an array.

Parameters: p the current project

Returns: an array of selectors in this container

hasSelectors

public boolean hasSelectors()
Indicates whether there are any selectors here.

Returns: whether any selectors are in this container

selectorCount

public int selectorCount()
Gives the count of the number of selectors in this container

Returns: the number of selectors in this container

selectorElements

public Enumeration selectorElements()
Returns an enumerator for accessing the set of selectors.

Returns: an enumerator that goes through each of the selectors

setCaseSensitive

public void setCaseSensitive(boolean isCaseSensitive)
Sets case sensitivity of the file system

Parameters: isCaseSensitive "true"|"on"|"yes" if file system is case sensitive, "false"|"off"|"no" when not.

setDefaultexcludes

public void setDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.

Parameters: useDefaultExcludes "true"|"on"|"yes" when default exclusions should be used, "false"|"off"|"no" when they shouldn't be used.

setExcludes

public void setExcludes(String excludes)
Sets the set of exclude patterns. Patterns may be separated by a comma or a space.

Parameters: excludes the string containing the exclude patterns

setExcludesfile

public void setExcludesfile(File excludesfile)
Sets the name of the file containing the includes patterns.

Parameters: excludesfile A string containing the filename to fetch the include patterns from.

setFollowSymlinks

public void setFollowSymlinks(boolean followSymlinks)
Sets whether or not symbolic links should be followed.

Parameters: followSymlinks whether or not symbolic links should be followed

setIncludes

public void setIncludes(String includes)
Sets the set of include patterns. Patterns may be separated by a comma or a space.

Parameters: includes the string containing the include patterns

setIncludesfile

public void setIncludesfile(File includesfile)
Sets the name of the file containing the includes patterns.

Parameters: includesfile A string containing the filename to fetch the include patterns from.

setProject

public void setProject(Project project)
{@inheritDoc}.

XsetIgnore

public void XsetIgnore(String ignoreString)
List of filenames and directory names to not include. They should be either , or " " (space) separated. The ignored files will be logged.

Parameters: ignoreString the string containing the files to ignore.

XsetItems

public void XsetItems(String itemString)
Set this to be the items in the base directory that you want to be included. You can also specify "*" for the items (ie: items="*") and it will include all the items in the base directory.

Parameters: itemString the string containing the files to include.