public class MatchRegularExpression extends FilePathMatcher
Constructor and Description |
---|
MatchRegularExpression() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canMatchSubdirectories()
Determines if it possible to match a file in a subdirectory.
|
void |
checkMisconfigured(BeanInstanceMap defaultInstances)
Checks that a bean's properties conform to expectations.
|
protected CheckedPredicate<Path,IOException> |
createMatcherFile(Path directory,
Optional<InputContextParameters> inputContext)
Create a predicate to be used for matching against path.
|
String |
getExpression()
The regular-expression, Java-style as described in
Pattern . |
boolean |
isApplyToPath()
If true, the filter is applied to the path, not just the filename (using forward slashes as
directory separators)
|
void |
setApplyToPath(boolean applyToPath)
If true, the filter is applied to the path, not just the filename (using forward slashes as
directory separators)
|
void |
setExpression(String expression)
The regular-expression, Java-style as described in
Pattern . |
matchingFiles, matchingFiles
describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
public void checkMisconfigured(BeanInstanceMap defaultInstances) throws BeanMisconfiguredException
AnchorBean
checkMisconfigured
in class AnchorBean<FilePathMatcher>
defaultInstances
- all available default instances if the DefaultInstance
annotation is usedBeanMisconfiguredException
- if the bean has not been configured properly as XMLprotected CheckedPredicate<Path,IOException> createMatcherFile(Path directory, Optional<InputContextParameters> inputContext)
FilePathMatcher
createMatcherFile
in class FilePathMatcher
directory
- the directory being searched. Only paths in this directory (or its
subdirectories) will ever be passed to the predicate.inputContext
- the input-context.directory
.protected boolean canMatchSubdirectories()
FilePathMatcher
If it impossible to match a subdirectory, this allows us to disable any recursive search, as it is pointless effort.
canMatchSubdirectories
in class FilePathMatcher
createMatcherFile
to match
a file in a subdirectory, false otherwise.public boolean isApplyToPath()
By path, we refer to the relative-path to the file being considered, relative to the directory in which the search started.
e.g. if a file /a/b/c/d.txt
is encountered, then the regular-expression will match
against c/d.txt
when applyToPath==true
, and d.txt
otherwise.
public void setApplyToPath(boolean applyToPath)
By path, we refer to the relative-path to the file being considered, relative to the directory in which the search started.
e.g. if a file /a/b/c/d.txt
is encountered, then the regular-expression will match
against c/d.txt
when applyToPath==true
, and d.txt
otherwise.
public String getExpression()
Pattern
.
Regular expressions should be written to expect a forward-slash as the directory-separator, irrespective of operating system. This guarantees consistent behavior across operating systems.
Backslashes are not permitted as directory-seperators, only as escape characters.
public void setExpression(String expression)
Pattern
.
Regular expressions should be written to expect a forward-slash as the directory-separator, irrespective of operating system. This guarantees consistent behavior across operating systems.
Backslashes are not permitted as directory-seperators, only as escape characters.
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.