public final class GlobMatcher extends Object
This class is not thread-safe.
Modifier and Type | Field and Description |
---|---|
String |
globPattern
The string representation of the glob pattern.
|
Matcher |
matcher
The underlying
java.util.regex.Matcher . |
Constructor and Description |
---|
GlobMatcher(String globPattern)
Constructs a glob pattern matcher.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
containsGlobChar(String string,
boolean includingTilde)
Convenience method: returns
true if specified string
contains a special character ('?', '*', '[',
'{'); returns false otherwise. |
static GlobMatcher |
create(String globPattern)
Convenience method: creates a matcher for specified pattern, but unlike
the constructor, this method does not raise an exception if this fails.
|
boolean |
equals(Object other) |
int |
hashCode() |
boolean |
matches(String string)
Matches this glob pattern against specified string.
|
String |
toString() |
public final String globPattern
public final Matcher matcher
java.util.regex.Matcher
.public GlobMatcher(String globPattern) throws PatternSyntaxException
globPattern
- the glob patternPatternSyntaxException
- if specified glob pattern cannot be
compiled into a java.util.regex.Pattern
public boolean matches(String string)
string
- string to be matched against this glob patterntrue
if specified string (in its entirety) matches
this glob pattern; false
otherwisepublic static GlobMatcher create(String globPattern)
null
.public static boolean containsGlobChar(String string, boolean includingTilde)
true
if specified string
contains a special character ('?', '*', '[',
'{'); returns false
otherwise. If
includingTilde is true, then '~' must also be
considered as being a special character.