@Plugin(name="IfFileName", category="Core", printObject=true) public final class IfFileName extends Object implements PathCondition
The regular expression is a pattern as defined by the Pattern
class. A glob is a simplified pattern
expression described in FileSystem.getPathMatcher(String)
.
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Path basePath,
Path relativePath,
BasicFileAttributes attrs)
Returns
true if the specified candidate path should be deleted, false otherwise. |
void |
beforeFileTreeWalk()
Invoked before a new file
tree walk is started.
|
static IfFileName |
createNameCondition(String glob,
String regex,
PathCondition... nestedConditions)
Creates a IfFileName condition that returns true if either the specified
glob pattern or the regular expression matches the relative path.
|
List<PathCondition> |
getNestedConditions() |
String |
getSyntaxAndPattern()
Returns the baseDir-relative path pattern of the files to delete.
|
String |
toString() |
public String getSyntaxAndPattern()
syntax:pattern
where syntax is one of "glob" or "regex" and the pattern is either a regular expression or a simplified pattern expression described under "glob" in
FileSystem.getPathMatcher(String)
.public List<PathCondition> getNestedConditions()
public boolean accept(Path basePath, Path relativePath, BasicFileAttributes attrs)
PathCondition
true
if the specified candidate path should be deleted, false
otherwise.accept
in interface PathCondition
basePath
- the directory from where to start scanning for deletion candidate filesrelativePath
- the candidate for deletion. This path is relative to the baseDir.attrs
- attributes of the candidate pathpublic void beforeFileTreeWalk()
PathCondition
beforeFileTreeWalk
in interface PathCondition
@PluginFactory public static IfFileName createNameCondition(@PluginAttribute(value="glob") String glob, @PluginAttribute(value="regex") String regex, @PluginElement(value="PathConditions") PathCondition... nestedConditions)
glob
- the baseDir-relative path pattern of the files to delete (may contain '*' and '?' wildcarts)regex
- the regular expression that matches the baseDir-relative path of the file(s) to deletenestedConditions
- nested conditions to evaluate if this condition accepts a pathFileSystem.getPathMatcher(String)
Copyright © 1999-2017. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.