public class TokenizedPattern
extends java.lang.Object
SelectorUtils.matchPath(String, String)
,
SelectorUtils.matchPath(String, String, boolean)
Modifier and Type | Field and Description |
---|---|
static TokenizedPattern |
EMPTY_PATTERN
Instance that holds no tokens at all.
|
Constructor and Description |
---|
TokenizedPattern(java.lang.String pattern)
Initialize the PathPattern by parsing it.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsPattern(java.lang.String pat)
Does the tokenized pattern contain the given string?
|
int |
depth()
The depth (or length) of a pattern.
|
boolean |
endsWith(java.lang.String s)
true if the last token equals the given string.
|
boolean |
equals(java.lang.Object o)
true if the original patterns are equal.
|
java.lang.String |
getPattern() |
int |
hashCode() |
boolean |
matchPath(TokenizedPath path,
boolean isCaseSensitive)
Tests whether or not a given path matches a given pattern.
|
boolean |
matchStartOf(TokenizedPath path,
boolean caseSensitive)
Tests whether or not this pattern matches the start of
a path.
|
TokenizedPath |
rtrimWildcardTokens()
Returns a new TokenizedPath where all tokens of this pattern to
the right containing wildcards have been removed
|
java.lang.String |
toString() |
TokenizedPattern |
withoutLastToken()
Returns a new pattern without the last token of this pattern.
|
public static final TokenizedPattern EMPTY_PATTERN
public TokenizedPattern(java.lang.String pattern)
pattern
- The pattern to match against. Must not be
null
.public boolean matchPath(TokenizedPath path, boolean isCaseSensitive)
path
- The path to match, as a String. Must not be
null
.isCaseSensitive
- Whether or not matching should be performed
case sensitively.true
if the pattern matches against the string,
or false
otherwise.public boolean matchStartOf(TokenizedPath path, boolean caseSensitive)
path
- TokenizedPathcaseSensitive
- booleanpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getPattern()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Objectpublic int hashCode()
hashCode
in class java.lang.Object
public int depth()
public boolean containsPattern(java.lang.String pat)
pat
- Stringpublic TokenizedPath rtrimWildcardTokens()
public boolean endsWith(java.lang.String s)
s
- Stringpublic TokenizedPattern withoutLastToken()