public abstract class AbstractGlobPatternCompiler extends Object implements PatternCompiler
PatternCompiler
interface for glob-patterns.GlobPatternCompiler
,
PathPatternCompiler
Modifier and Type | Field and Description |
---|---|
private static char[] |
CHARS_TO_ESCAPE
The characters that have to be escaped in a regular expression.
|
Constructor and Description |
---|
AbstractGlobPatternCompiler()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
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 . |
private static final char[] CHARS_TO_ESCAPE
public AbstractGlobPatternCompiler()
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
).Copyright © 2001–2016 mmm-Team. All rights reserved.