public static class PathWatcher.Config extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Path |
dir |
protected boolean |
excludeHidden |
protected List<PathMatcher> |
excludes |
protected List<PathMatcher> |
includes |
protected int |
recurseDepth |
static int |
UNLIMITED_DEPTH |
| Modifier and Type | Method and Description |
|---|---|
void |
addExclude(PathMatcher matcher)
Add an exclude PathMatcher
|
void |
addExclude(String syntaxAndPattern)
Add an exclude PathMatcher.
|
void |
addExcludeGlobRelative(String pattern)
Add a
glob: syntax pattern exclude reference in a directory relative, os neutral, pattern. |
void |
addExcludeHidden()
Exclude hidden files and hidden directories
|
void |
addExcludes(List<String> syntaxAndPatterns)
Add multiple exclude PathMatchers
|
void |
addInclude(PathMatcher matcher)
Add an include PathMatcher
|
void |
addInclude(String syntaxAndPattern)
Add an include PathMatcher
|
void |
addIncludeGlobRelative(String pattern)
Add a
glob: syntax pattern reference in a directory relative, os neutral, pattern. |
void |
addIncludes(List<String> syntaxAndPatterns)
Add multiple include PathMatchers
|
PathWatcher.Config |
asSubConfig(Path dir)
Build a new config from a this configuration.
|
Path |
getPath() |
int |
getRecurseDepth() |
boolean |
isExcluded(Path dir) |
boolean |
isIncluded(Path dir) |
boolean |
isRecurseDepthUnlimited() |
boolean |
matches(Path path) |
void |
setRecurseDepth(int depth)
Set the recurse depth for the directory scanning.
|
boolean |
shouldRecurseDirectory(Path child)
Determine if the provided child directory should be recursed into based on the configured
setRecurseDepth(int) |
String |
toString() |
public static final int UNLIMITED_DEPTH
protected final Path dir
protected int recurseDepth
protected List<PathMatcher> includes
protected List<PathMatcher> excludes
protected boolean excludeHidden
public Config(Path path)
public void addExclude(PathMatcher matcher)
matcher - the path matcher for this excludepublic void addExclude(String syntaxAndPattern)
Note: this pattern is FileSystem specific (so use "/" for Linux and OSX, and "\\" for Windows)
syntaxAndPattern - the PathMatcher syntax and pattern to usefor detail on syntax and patternpublic void addExcludeGlobRelative(String pattern)
glob: syntax pattern exclude reference in a directory relative, os neutral, pattern.
On Linux:
Config config = new Config(Path("/home/user/example"));
config.addExcludeGlobRelative("*.war") => "glob:/home/user/example/*.war"
On Windows
Config config = new Config(Path("D:/code/examples"));
config.addExcludeGlobRelative("*.war") => "glob:D:\\code\\examples\\*.war"
pattern - the pattern, in unixy format, relative to config.dirpublic void addExcludeHidden()
public void addExcludes(List<String> syntaxAndPatterns)
syntaxAndPatterns - the list of PathMatcher syntax and patterns to usefor detail on syntax and patternpublic void addInclude(PathMatcher matcher)
matcher - the path matcher for this includepublic void addInclude(String syntaxAndPattern)
syntaxAndPattern - the PathMatcher syntax and pattern to usefor detail on syntax and patternpublic void addIncludeGlobRelative(String pattern)
glob: syntax pattern reference in a directory relative, os neutral, pattern.
On Linux:
Config config = new Config(Path("/home/user/example"));
config.addIncludeGlobRelative("*.war") => "glob:/home/user/example/*.war"
On Windows
Config config = new Config(Path("D:/code/examples"));
config.addIncludeGlobRelative("*.war") => "glob:D:\\code\\examples\\*.war"
pattern - the pattern, in unixy format, relative to config.dirpublic void addIncludes(List<String> syntaxAndPatterns)
syntaxAndPatterns - the list of PathMatcher syntax and patterns to usefor detail on syntax and patternpublic PathWatcher.Config asSubConfig(Path dir)
Useful for working with sub-directories that also need to be watched.
dir - the directory to build new Config from (using this config as source of includes/excludes)public int getRecurseDepth()
public boolean isRecurseDepthUnlimited()
public Path getPath()
public boolean isExcluded(Path dir) throws IOException
IOExceptionpublic boolean isIncluded(Path dir)
public boolean matches(Path path)
public void setRecurseDepth(int depth)
-999 indicates arbitrarily deep recursion, 0 indicates no recursion, 1 is only one directory deep, and so on.
depth - the number of directories deep to recursepublic boolean shouldRecurseDirectory(Path child)
setRecurseDepth(int)child - the child directory to test againstCopyright © 1995-2016 Webtide. All Rights Reserved.