|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.apache.tiles.util.WildcardHelper
public class WildcardHelper
This class is an utility class that perform wilcard-patterns matching and isolation taken from Apache Struts that is taken, in turn, from Apache Struts.
| Field Summary | |
|---|---|
protected static int |
MATCH_BEGIN
The int representing begin in the pattern int []. |
protected static int |
MATCH_END
The int value that terminates the pattern int []. |
protected static int |
MATCH_FILE
The int representing '*' in the pattern int []. |
protected static int |
MATCH_PATH
The int representing '**' in the pattern int []. |
protected static int |
MATCH_THEEND
The int representing end in pattern int []. |
| Constructor Summary | |
|---|---|
WildcardHelper()
|
|
| Method Summary | |
|---|---|
int[] |
compilePattern(String data)
Translate the given String into a int []
representing the pattern matchable by this class. |
static String |
convertParam(String val,
Map<Integer,String> vars)
Inserts into a value wildcard-matched strings where specified. |
protected int |
indexOfArray(int[] r,
int rpos,
int rend,
char[] d,
int dpos)
Get the offset of a part of an int array within a char array. |
protected int |
lastIndexOfArray(int[] r,
int rpos,
int rend,
char[] d,
int dpos)
Get the offset of a last occurance of an int array within a char array. |
boolean |
match(Map<Integer,String> map,
String data,
int[] expr)
Deprecated. Use #match(List, String, int[]). |
List<String> |
match(String data,
int[] expr)
Match a pattern agains a string and isolates wildcard replacement into a Stack. |
protected boolean |
matchArray(int[] r,
int rpos,
int rend,
char[] d,
int dpos)
Matches elements of array r from rpos to rend with array d, starting from dpos. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int MATCH_FILE
int [].
protected static final int MATCH_PATH
int [].
protected static final int MATCH_BEGIN
int [].
protected static final int MATCH_THEEND
int [].
protected static final int MATCH_END
int [].
| Constructor Detail |
|---|
public WildcardHelper()
| Method Detail |
|---|
public int[] compilePattern(String data)
Translate the given String into a int []
representing the pattern matchable by this class.
This function translates a String into an int array
converting the special '*' and '\' characters.
Here is how the conversion algorithm works:
When more than two '*' characters, not separated by another character,
are found their value is considered as '**' (MATCH_PATH).
The array is always terminated by a special value (MATCH_END).
All MATCH* values are less than zero, while normal characters are equal
or greater.
data - The string to translate.
NullPointerException - If data is null.
public boolean match(Map<Integer,String> map,
String data,
int[] expr)
#match(List, String, int[]).
Stack.
map - The map to store matched valuesdata - The string to matchexpr - The compiled wildcard expression
NullPointerException - If any parameters are null
public List<String> match(String data,
int[] expr)
Stack.
data - The string to matchexpr - The compiled wildcard expression
null if it does not match.
NullPointerException - If any parameters are null
protected int indexOfArray(int[] r,
int rpos,
int rend,
char[] d,
int dpos)
r - The array containing the data that need to be matched in d.rpos - The index of the first character in r to look for.rend - The index of the last character in r to look for plus 1.d - The array of char that should contain a part of r.dpos - The starting offset in d for the matching.
protected int lastIndexOfArray(int[] r,
int rpos,
int rend,
char[] d,
int dpos)
r - The array containing the data that need to be matched in d.rpos - The index of the first character in r to look for.rend - The index of the last character in r to look for plus 1.d - The array of char that should contain a part of r.dpos - The starting offset in d for the matching.
protected boolean matchArray(int[] r,
int rpos,
int rend,
char[] d,
int dpos)
r - The array containing the data that need to be matched in d.rpos - The index of the first character in r to look for.rend - The index of the last character in r to look for.d - The array of char that should start from a part of r.dpos - The starting offset in d for the matching.
public static String convertParam(String val,
Map<Integer,String> vars)
Inserts into a value wildcard-matched strings where specified.
val - The value to convertvars - A Map of wildcard-matched strings
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||