Class DependScanner
java.lang.Object
org.apache.tools.ant.DirectoryScanner
org.apache.tools.ant.types.optional.depend.DependScanner
- All Implemented Interfaces:
FileScanner
,ResourceFactory
,SelectorScanner
public class DependScanner extends DirectoryScanner
DirectoryScanner for finding class dependencies.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_ANALYZER_CLASS
The name of the analyzer to use by default.Fields inherited from class org.apache.tools.ant.DirectoryScanner
basedir, DEFAULTEXCLUDES, dirsDeselected, dirsExcluded, dirsIncluded, dirsNotIncluded, DOES_NOT_EXIST_POSTFIX, errorOnMissingDir, everythingIncluded, excludes, filesDeselected, filesExcluded, filesIncluded, filesNotIncluded, haveSlowResults, includes, isCaseSensitive, MAX_LEVELS_OF_SYMLINKS, selectors
-
Constructor Summary
Constructors Constructor Description DependScanner(DirectoryScanner parentScanner)
Create a DependScanner, using the given scanner to provide the basic set of files from which class files come. -
Method Summary
Modifier and Type Method Description void
addBasedir(java.io.File baseDir)
void
addDefaultExcludes()
Add default exclusions to the current exclusions set.java.lang.String[]
getExcludedDirectories()
Return the names of the directories which matched at least one of the include patterns and at least one of the exclude patterns.java.lang.String[]
getExcludedFiles()
Return the names of the files which matched at least one of the include patterns and at least one of the exclude patterns.java.lang.String[]
getIncludedDirectories()
Return the names of the directories which matched at least one of the include patterns and none of the exclude patterns.int
getIncludedDirsCount()
Return the count of included directories.java.lang.String[]
getIncludedFiles()
Get the names of the class files on which baseClass depends.int
getIncludedFilesCount()
Return the count of included files.java.lang.String[]
getNotIncludedDirectories()
Return the names of the directories which matched none of the include patterns.java.lang.String[]
getNotIncludedFiles()
Return the names of the files which matched none of the include patterns.void
scan()
Scans the base directory for files on which baseClass depends.void
setCaseSensitive(boolean isCaseSensitive)
Set whether or not include and exclude patterns are matched in a case sensitive way.void
setExcludes(java.lang.String[] excludes)
Set the list of exclude patterns to use.void
setIncludes(java.lang.String[] includes)
Set the list of include patterns to use.void
setRootClasses(java.util.Vector<java.lang.String> rootClasses)
Sets the root classes to be used to drive the scan.Methods inherited from class org.apache.tools.ant.DirectoryScanner
addDefaultExclude, addExcludes, clearResults, couldHoldIncluded, getBasedir, getDefaultExcludes, getDeselectedDirectories, getDeselectedFiles, getNotFollowedSymlinks, getResource, isCaseSensitive, isEverythingIncluded, isExcluded, isFollowSymlinks, isIncluded, isSelected, match, match, matchPath, matchPath, matchPatternStart, matchPatternStart, removeDefaultExclude, resetDefaultExcludes, scandir, setBasedir, setBasedir, setErrorOnMissingDir, setFollowSymlinks, setMaxLevelsOfSymlinks, setSelectors, slowScan
-
Field Details
-
DEFAULT_ANALYZER_CLASS
public static final java.lang.String DEFAULT_ANALYZER_CLASSThe name of the analyzer to use by default.- See Also:
- Constant Field Values
-
-
Constructor Details
-
DependScanner
Create a DependScanner, using the given scanner to provide the basic set of files from which class files come.- Parameters:
parentScanner
- the DirectoryScanner which returns the files from which class files must come.
-
-
Method Details
-
setRootClasses
public void setRootClasses(java.util.Vector<java.lang.String> rootClasses)Sets the root classes to be used to drive the scan.- Parameters:
rootClasses
- the rootClasses to be used for this scan.
-
getIncludedFiles
public java.lang.String[] getIncludedFiles()Get the names of the class files on which baseClass depends.- Specified by:
getIncludedFiles
in interfaceFileScanner
- Overrides:
getIncludedFiles
in classDirectoryScanner
- Returns:
- the names of the files.
-
getIncludedFilesCount
public int getIncludedFilesCount()Return the count of included files..- Overrides:
getIncludedFilesCount
in classDirectoryScanner
- Returns:
int
.
-
scan
public void scan() throws java.lang.IllegalStateExceptionScans the base directory for files on which baseClass depends.- Specified by:
scan
in interfaceFileScanner
- Overrides:
scan
in classDirectoryScanner
- Throws:
java.lang.IllegalStateException
- when basedir was set incorrectly.
-
addDefaultExcludes
public void addDefaultExcludes()Description copied from class:DirectoryScanner
Add default exclusions to the current exclusions set.- Specified by:
addDefaultExcludes
in interfaceFileScanner
- Overrides:
addDefaultExcludes
in classDirectoryScanner
- See Also:
DirectoryScanner.addDefaultExcludes()
-
getExcludedDirectories
public java.lang.String[] getExcludedDirectories()Description copied from class:DirectoryScanner
Return the names of the directories which matched at least one of the include patterns and at least one of the exclude patterns. The names are relative to the base directory. This involves performing a slow scan if one has not already been completed.- Specified by:
getExcludedDirectories
in interfaceFileScanner
- Overrides:
getExcludedDirectories
in classDirectoryScanner
- Returns:
- the names of the directories which matched at least one of the include patterns and at least one of the exclude patterns.
- See Also:
.
-
getExcludedFiles
public java.lang.String[] getExcludedFiles()Description copied from class:DirectoryScanner
Return the names of the files which matched at least one of the include patterns and at least one of the exclude patterns. The names are relative to the base directory. This involves performing a slow scan if one has not already been completed.- Specified by:
getExcludedFiles
in interfaceFileScanner
- Overrides:
getExcludedFiles
in classDirectoryScanner
- Returns:
- the names of the files which matched at least one of the include patterns and at least one of the exclude patterns.
- See Also:
.
-
getIncludedDirectories
public java.lang.String[] getIncludedDirectories()Description copied from class:DirectoryScanner
Return the names of the directories which matched at least one of the include patterns and none of the exclude patterns. The names are relative to the base directory.- Specified by:
getIncludedDirectories
in interfaceFileScanner
- Overrides:
getIncludedDirectories
in classDirectoryScanner
- Returns:
- the names of the directories which matched at least one of the include patterns and none of the exclude patterns.
- See Also:
.
-
getIncludedDirsCount
public int getIncludedDirsCount()Description copied from class:DirectoryScanner
Return the count of included directories.- Overrides:
getIncludedDirsCount
in classDirectoryScanner
- Returns:
int
.- See Also:
.
-
getNotIncludedDirectories
public java.lang.String[] getNotIncludedDirectories()Description copied from class:DirectoryScanner
Return the names of the directories which matched none of the include patterns. The names are relative to the base directory. This involves performing a slow scan if one has not already been completed.- Specified by:
getNotIncludedDirectories
in interfaceFileScanner
- Overrides:
getNotIncludedDirectories
in classDirectoryScanner
- Returns:
- the names of the directories which matched none of the include patterns.
- See Also:
.
-
getNotIncludedFiles
public java.lang.String[] getNotIncludedFiles()Description copied from class:DirectoryScanner
Return the names of the files which matched none of the include patterns. The names are relative to the base directory. This involves performing a slow scan if one has not already been completed.- Specified by:
getNotIncludedFiles
in interfaceFileScanner
- Overrides:
getNotIncludedFiles
in classDirectoryScanner
- Returns:
- the names of the files which matched none of the include patterns.
- See Also:
.
-
setExcludes
public void setExcludes(java.lang.String[] excludes)Description copied from class:DirectoryScanner
Set the list of exclude patterns to use. All '/' and '\' characters are replaced byFile.separatorChar
, so the separator used need not matchFile.separatorChar
.When a pattern ends with a '/' or '\', "**" is appended.
- Specified by:
setExcludes
in interfaceFileScanner
- Overrides:
setExcludes
in classDirectoryScanner
- Parameters:
excludes
- A list of exclude patterns. May benull
, indicating that no files should be excluded. If a non-null
list is given, all elements must be non-null
.- See Also:
.
-
setIncludes
public void setIncludes(java.lang.String[] includes)Description copied from class:DirectoryScanner
Set the list of include patterns to use. All '/' and '\' characters are replaced byFile.separatorChar
, so the separator used need not matchFile.separatorChar
.When a pattern ends with a '/' or '\', "**" is appended.
- Specified by:
setIncludes
in interfaceFileScanner
- Overrides:
setIncludes
in classDirectoryScanner
- Parameters:
includes
- A list of include patterns. May benull
, indicating that all files should be included. If a non-null
list is given, all elements must be non-null
.- See Also:
.
-
setCaseSensitive
public void setCaseSensitive(boolean isCaseSensitive)Description copied from class:DirectoryScanner
Set whether or not include and exclude patterns are matched in a case sensitive way.- Specified by:
setCaseSensitive
in interfaceFileScanner
- Overrides:
setCaseSensitive
in classDirectoryScanner
- Parameters:
isCaseSensitive
- whether or not the file system should be regarded as a case sensitive one.- See Also:
.
-
addBasedir
public void addBasedir(java.io.File baseDir)
-