public abstract class BasePathMacros extends java.lang.Object implements PathMacros
PathMacro implementations.
Assume that macros are defined in the following way:
prefix{name:pattern}suffix.
Pattern is optional, and if missing all values are matched.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String[] |
fixed |
protected int |
macrosCount |
protected java.lang.String[] |
names |
protected java.lang.String[] |
patterns |
| Constructor and Description |
|---|
BasePathMacros() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String[] |
extract(java.lang.String actionPath)
Extracts array of macro values for matched action path
for each
name. |
boolean |
init(java.lang.String actionPath,
java.lang.String[] separators)
Initializes
PathMacro and returns
true if macros are found in the action
path. |
int |
macrosCount()
Returns macros count.
|
int |
match(java.lang.String actionPath)
Match provided action path with the path macros,
Returns the number of matched non-macro characters.
|
protected abstract boolean |
matchValue(int macroIndex,
java.lang.String value)
Matches the stripped value with the pattern.
|
java.lang.String[] |
names()
Returns names of all macros.
|
java.lang.String[] |
patterns()
Returns all patterns.
|
protected int macrosCount
protected java.lang.String[] names
protected java.lang.String[] patterns
protected java.lang.String[] fixed
public boolean init(java.lang.String actionPath,
java.lang.String[] separators)
PathMacro and returns
true if macros are found in the action
path. Otherwise, returns false and
the instance can be thrown away.
Separators is array of 3 strings that defines: start, dividing string, and end of a macro.
init in interface PathMacrospublic java.lang.String[] names()
names in interface PathMacrospublic java.lang.String[] patterns()
null
if some macro does not define a pattern.patterns in interface PathMacrospublic int macrosCount()
macrosCount in interface PathMacrospublic int match(java.lang.String actionPath)
match in interface PathMacrosprotected abstract boolean matchValue(int macroIndex,
java.lang.String value)
macroIndex is not null!public java.lang.String[] extract(java.lang.String actionPath)
name. It is assumed
that path macro was previously PathMacros.init(String, String[]) initialized}
on this action path, i.e. input is not validated.
Returned array string of macro values may contain
null on all ignored macros.
extract in interface PathMacrosCopyright © 2003-present Jodd Team