|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.myjavaworld.util.RegexFilter
public class RegexFilter
Constructor Summary | |
---|---|
RegexFilter(String pattern,
int flags)
Creates an instance of RegexFilter . |
Method Summary | |
---|---|
boolean |
accept(Object value)
Checks to see if the given value can pass through this filter. |
Pattern |
getPattern()
Returns the current pattern being used by this filter. |
void |
setPattern(Pattern pattern)
Sets the pattern to be used by this filter to the given pattern. |
void |
setPattern(String pattern,
int flags)
Sets the pattern to be used by this filter to the given pattern. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RegexFilter(String pattern, int flags)
RegexFilter
.
pattern
- The regular expression or pattern.flags
- Additional flags to apply to the pattern.Method Detail |
---|
public void setPattern(String pattern, int flags)
java.util.Pattern
and a
call to the setPattern(Pattern pattern)
is made.
pattern
- The pattern to be used by this filter.flags
- Additional flags to apply to the pattern.public void setPattern(Pattern pattern)
pattern
- The pattern to be used by this filter.public Pattern getPattern()
public boolean accept(Object value)
java.lang.String
.
accept
in interface Filter
value
- The object to test.
true
if the given value contains the pattern as set
by the setPattern() method. false
otherwise.
ClassCastException
will thrown if the given vlue is
not an instance java.lang.String
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |