public class GlobPathMatcher
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
caseSensitive |
static java.lang.String |
DEFAULT_PATH_SEPARATOR
Default path separator: "/"
|
private java.lang.String |
pathSeparator |
private java.lang.String[] |
pattDirs |
private java.lang.String |
pattern |
private java.util.regex.Pattern[] |
pattPats |
Constructor and Description |
---|
GlobPathMatcher(java.lang.String pattern)
Create a new instance with the
DEFAULT_PATH_SEPARATOR . |
GlobPathMatcher(java.lang.String pattern,
java.lang.String pathSeparator,
boolean caseSensitive)
A convenient, alternative constructor to use with a custom path separator.
|
Modifier and Type | Method and Description |
---|---|
private java.util.regex.Pattern |
createMatcherPattern(java.lang.String pattern) |
boolean |
matches(java.lang.String path,
boolean fullMatch)
Actually match the given
path against the given pattern . |
private boolean |
matchStrings(int pattIdx,
java.lang.String str) |
private java.lang.String[] |
tokenizePath(java.lang.String path)
Tokenize the given path String into parts, based on this matcher's settings.
|
public static final java.lang.String DEFAULT_PATH_SEPARATOR
private java.lang.String pattern
private java.lang.String pathSeparator
private boolean caseSensitive
private java.lang.String[] pattDirs
private java.util.regex.Pattern[] pattPats
public GlobPathMatcher(java.lang.String pattern)
DEFAULT_PATH_SEPARATOR
.public GlobPathMatcher(java.lang.String pattern, java.lang.String pathSeparator, boolean caseSensitive)
pathSeparator
- the path separator to use, must not be null
.public boolean matches(java.lang.String path, boolean fullMatch)
path
against the given pattern
.path
- the path String to testfullMatch
- whether a full pattern match is required (else a pattern match
as far as the given base path goes is sufficient)true
if the supplied path
matched, false
if it didn'tprivate java.lang.String[] tokenizePath(java.lang.String path)
path
- the path to tokenizeprivate boolean matchStrings(int pattIdx, java.lang.String str)
private java.util.regex.Pattern createMatcherPattern(java.lang.String pattern)