public class PatternFilterRule extends Object implements FilterRule<String>
FilterRule interface that matches using a regex Pattern.| Modifier and Type | Field and Description |
|---|---|
private Pattern |
pattern |
private Boolean |
result |
| Constructor and Description |
|---|
PatternFilterRule()
The non-arg constructor.
|
PatternFilterRule(Pattern pattern,
boolean resultOnMatch)
The constructor.
|
PatternFilterRule(String pattern,
boolean resultOnMatch)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Boolean |
accept(String string)
This method checks if the given
string is accepted, denied or ignored by this rule. |
private Pattern pattern
accept(String)private Boolean result
accept(String)public PatternFilterRule()
public PatternFilterRule(String pattern, boolean resultOnMatch)
pattern - is the pattern a file has to match in order to activate this rule. Before this given
string is compiled via Pattern.compile(String) the following manipulation is performed: If
the pattern string does NOT start with the character ^ the implicit prefix
.* is added. If the pattern does NOT end with the character $ the
implicit suffix .* is appended.resultOnMatch - is the result returned if the pattern matches.public Boolean accept(String string)
string is accepted, denied or ignored by this rule.accept in interface FilterRule<String>string - is the string to check.true if the file should be accepted, false if the file should NOT be
accepted or null if this rule does NOT make a decision about the given
string.Copyright © 2001–2015 mmm-Team. All rights reserved.