Package com.aspectran.utils.wildcard
Class WildcardPattern
java.lang.Object
com.aspectran.utils.wildcard.WildcardPattern
The Class WildcardPattern.
The following standard quantifiers are recognized:
*
- matches single character
+
- matches one or more characters
?
- matches zero or more characters
**
- matches zero or more string delimited by separators
\
- Wildcard characters can be escaped
Examples
- /static/
*
- /static/a.jpg
- /static
*
/**
/b/*
- matches one or more characters
- /static
*
/**
- /static/a/a.jpg
**
/static/**
- a/b/static/a/b/c/a.jpg
- /static-
?
/a?
?
.jpg - /static-a/abc.jpg
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char
static final char
static final char
-
Constructor Summary
ConstructorsConstructorDescriptionWildcardPattern
(String patternString) WildcardPattern
(String patternString, char separator) -
Method Summary
Modifier and TypeMethodDescriptionstatic WildcardPattern
static WildcardPattern
boolean
char
protected char[]
protected int[]
getTypes()
float
int
hashCode()
static boolean
hasWildcards
(String str) Erase the characters that corresponds to the wildcard, and returns collect only the remaining characters.boolean
If the pattern matches then returns true.toString()
-
Field Details
-
STAR_CHAR
public static final char STAR_CHAR- See Also:
-
QUESTION_CHAR
public static final char QUESTION_CHAR- See Also:
-
PLUS_CHAR
public static final char PLUS_CHAR- See Also:
-
-
Constructor Details
-
WildcardPattern
-
WildcardPattern
-
-
Method Details
-
getSeparator
public char getSeparator() -
getTokens
protected char[] getTokens() -
getTypes
protected int[] getTypes() -
getWeight
public float getWeight() -
matches
If the pattern matches then returns true.- Parameters:
compareString
- the compare string- Returns:
- true, if successful
-
mask
Erase the characters that corresponds to the wildcard, and returns collect only the remaining characters. In other words, only it remains for the wildcard character.- Parameters:
nakedString
- the naked string- Returns:
- the masked string
-
equals
-
hashCode
public int hashCode() -
toString
-
compile
-
compile
-
hasWildcards
-