|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.mmm.util.pattern.base.AbstractGlobPatternCompiler
public abstract class AbstractGlobPatternCompiler
This is an abstract base-implementation of the PatternCompiler
interface for glob-patterns.
GlobPatternCompiler
,
PathPatternCompiler
Field Summary | |
---|---|
private static char[] |
CHARS_TO_ESCAPE
The characters that have to be escaped in a regular expression. |
Constructor Summary | |
---|---|
AbstractGlobPatternCompiler()
The constructor. |
Method Summary | |
---|---|
Pattern |
compile(String pattern)
|
protected String |
convertPattern(String pattern)
This method converts the given pattern to a
regex-pattern . |
protected boolean |
isRequireWildcard()
This method gets the flag that determines if wildcards are required. |
protected int |
process(char[] chars,
int charIndex,
StringBuilder buffer)
This method processes one or many characters from chars
starting at the given charIndex and adds the translated
regexp-sequence to buffer . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final char[] CHARS_TO_ESCAPE
Constructor Detail |
---|
public AbstractGlobPatternCompiler()
Method Detail |
---|
public Pattern compile(String pattern) throws IllegalArgumentException
compile
in interface PatternCompiler
pattern
- is the expression to be compiled as pattern.
null
if
explicitly documented by the underlying implementation. E.g. if the
given pattern
is just a plain string without
wildcards.
IllegalArgumentException
- if the given pattern
has
illegal syntax for the underlying compiler.Pattern.compile(String)
protected boolean isRequireWildcard()
false
. Override to change.
true
if wildcards are required. In that case
null
is returned
if the given
pattern
contains no wildcard ('*' or '?').
false
otherwise.protected String convertPattern(String pattern)
pattern
to a
regex-pattern
.
pattern
- is the pattern to convert.
null
if
isRequireWildcard()
is true
and the given
pattern
contains no wildcard ('*' or '?').protected int process(char[] chars, int charIndex, StringBuilder buffer)
chars
starting at the given charIndex
and adds the translated
regexp-sequence to buffer
.
chars
- are the characters of the original pattern string.charIndex
- is the current index in chars
.buffer
- is where the translated regexp-pattern is appended to.
charIndex + 1
).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |