Class DependScanner
java.lang.Object
org.apache.tools.ant.DirectoryScanner
org.apache.tools.ant.types.optional.depend.DependScanner
- All Implemented Interfaces:
FileScanner, ResourceFactory, SelectorScanner
DirectoryScanner for finding class dependencies.
-
Field Summary
FieldsFields inherited from class 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, selectorsModifier and TypeFieldDescriptionprotected FileThe base directory to be scanned.protected static final String[]Deprecated.since 1.6.x.The directories which matched at least one include and no excludes but which a selector discarded.The directories which matched at least one include and at least one exclude.The directories which matched at least one include and no excludes and were selected.The directories which were found and did not match any includes.static final StringThe end of the exception message if something that should be there doesn't exist.protected booleanWhether a missing base directory is an error.protected booleanWhether or not everything tested so far has been included.protected String[]The patterns for the files to be excluded.The files which matched at least one include and no excludes and which a selector discarded.The files which matched at least one include and at least one exclude.The files which matched at least one include and no excludes and were selected.The files which did not match any includes or selectors.protected booleanWhether or not our results were built by a slow scan.protected String[]The patterns for the files to be included.protected booleanWhether or not the file system should be treated as a case sensitive one.static final intdefault value formaxLevelsOfSymlinksprotected FileSelector[]Selectors that will filter which files are in our candidate list. -
Constructor Summary
ConstructorsConstructorDescriptionDependScanner(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 TypeMethodDescriptionvoidaddBasedir(File baseDir) voidAdd default exclusions to the current exclusions set.String[]Return the names of the directories which matched at least one of the include patterns and at least one of the exclude patterns.String[]Return the names of the files which matched at least one of the include patterns and at least one of the exclude patterns.String[]Return the names of the directories which matched at least one of the include patterns and none of the exclude patterns.intReturn the count of included directories.String[]Get the names of the class files on which baseClass depends.intReturn the count of included files.String[]Return the names of the directories which matched none of the include patterns.String[]Return the names of the files which matched none of the include patterns.voidscan()Scans the base directory for files on which baseClass depends.voidsetCaseSensitive(boolean isCaseSensitive) Set whether or not include and exclude patterns are matched in a case sensitive way.voidsetExcludes(String[] excludes) Set the list of exclude patterns to use.voidsetIncludes(String[] includes) Set the list of include patterns to use.voidsetRootClasses(Vector<String> rootClasses) Sets the root classes to be used to drive the scan.Methods inherited from class 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, slowScanModifier and TypeMethodDescriptionstatic booleanAdd a pattern to the default excludes unless it is already a default exclude.voidaddExcludes(String[] excludes) Add to the list of exclude patterns to use.protected voidClear the result caches for a scan.protected booleancouldHoldIncluded(String name) Test whether or not a name matches the start of at least one include pattern.Return the base directory to be scanned.static String[]Get the list of patterns that should be excluded by default.String[]Return the names of the directories which were selected out and therefore not ultimately included.String[]Return the names of the files which were selected out and therefore not ultimately included.String[]Absolute paths of all symbolic links or Windows junctions that haven't been followed but would have been followed had followsymlinks been true or maxLevelsOfSymlinks been bigger.getResource(String name) Get the named resource.booleanFind out whether include exclude patterns are matched in a case sensitive way.booleanReturn whether or not the scanner has included all the files or directories it has come across so far.protected booleanisExcluded(String name) Test whether or not a name matches against at least one exclude pattern.booleanGet whether or not a DirectoryScanner follows symbolic links or Windows junctions.protected booleanisIncluded(String name) Test whether or not a name matches against at least one include pattern.protected booleanisSelected(String name, File file) Test whether a file should be selected.static booleanTest whether or not a string matches against a pattern.protected static booleanTest whether or not a string matches against a pattern.protected static booleanTest whether or not a given path matches a given pattern.protected static booleanTest whether or not a given path matches a given pattern.protected static booleanmatchPatternStart(String pattern, String str) Test whether or not a given path matches the start of a given pattern up to the first "**".protected static booleanmatchPatternStart(String pattern, String str, boolean isCaseSensitive) Test whether or not a given path matches the start of a given pattern up to the first "**".static booleanRemove a string if it is a default exclude.static voidGo back to the hardwired default exclude patterns.protected voidScan the given directory for files and directories.voidsetBasedir(File basedir) Set the base directory to be scanned.voidsetBasedir(String basedir) Set the base directory to be scanned.voidsetErrorOnMissingDir(boolean errorOnMissingDir) Sets whether or not a missing base directory is an errorvoidsetFollowSymlinks(boolean followSymlinks) Set whether or not symbolic links or Windows junctions should be followed.voidsetMaxLevelsOfSymlinks(int max) The maximum number of times a symbolic link or Windows junctions may be followed during a scan.voidsetSelectors(FileSelector[] selectors) Set the selectors that will select the filelist.protected voidslowScan()Top level invocation for a slow scan.
-
Field Details
-
DEFAULT_ANALYZER_CLASS
The name of the analyzer to use by default.- See Also:
-
-
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
-
getIncludedFiles
Get the names of the class files on which baseClass depends.- Specified by:
getIncludedFilesin interfaceFileScanner- Overrides:
getIncludedFilesin classDirectoryScanner- Returns:
- the names of the files.
-
getIncludedFilesCount
public int getIncludedFilesCount()Return the count of included files..- Overrides:
getIncludedFilesCountin classDirectoryScanner- Returns:
int.
-
scan
Scans the base directory for files on which baseClass depends.- Specified by:
scanin interfaceFileScanner- Overrides:
scanin classDirectoryScanner- Throws:
IllegalStateException- when basedir was set incorrectly.
-
addDefaultExcludes
public void addDefaultExcludes()Description copied from class:DirectoryScannerAdd default exclusions to the current exclusions set.- Specified by:
addDefaultExcludesin interfaceFileScanner- Overrides:
addDefaultExcludesin classDirectoryScanner- See Also:
-
getExcludedDirectories
Description copied from class:DirectoryScannerReturn 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:
getExcludedDirectoriesin interfaceFileScanner- Overrides:
getExcludedDirectoriesin 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
Description copied from class:DirectoryScannerReturn 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:
getExcludedFilesin interfaceFileScanner- Overrides:
getExcludedFilesin 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
Description copied from class:DirectoryScannerReturn 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:
getIncludedDirectoriesin interfaceFileScanner- Overrides:
getIncludedDirectoriesin 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:DirectoryScannerReturn the count of included directories.- Overrides:
getIncludedDirsCountin classDirectoryScanner- Returns:
int.- See Also:
-
getNotIncludedDirectories
Description copied from class:DirectoryScannerReturn 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:
getNotIncludedDirectoriesin interfaceFileScanner- Overrides:
getNotIncludedDirectoriesin classDirectoryScanner- Returns:
- the names of the directories which matched none of the include patterns.
- See Also:
-
getNotIncludedFiles
Description copied from class:DirectoryScannerReturn 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:
getNotIncludedFilesin interfaceFileScanner- Overrides:
getNotIncludedFilesin classDirectoryScanner- Returns:
- the names of the files which matched none of the include patterns.
- See Also:
-
setExcludes
Description copied from class:DirectoryScannerSet 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:
setExcludesin interfaceFileScanner- Overrides:
setExcludesin classDirectoryScanner- Parameters:
excludes- A list of exclude patterns. May benull, indicating that no files should be excluded. If a non-nulllist is given, all elements must be non-null.- See Also:
-
setIncludes
Description copied from class:DirectoryScannerSet 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:
setIncludesin interfaceFileScanner- Overrides:
setIncludesin classDirectoryScanner- Parameters:
includes- A list of include patterns. May benull, indicating that all files should be included. If a non-nulllist is given, all elements must be non-null.- See Also:
-
setCaseSensitive
public void setCaseSensitive(boolean isCaseSensitive) Description copied from class:DirectoryScannerSet whether or not include and exclude patterns are matched in a case sensitive way.- Specified by:
setCaseSensitivein interfaceFileScanner- Overrides:
setCaseSensitivein classDirectoryScanner- Parameters:
isCaseSensitive- whether or not the file system should be regarded as a case sensitive one.- See Also:
-
addBasedir
-