public class RegexClassFilter extends java.lang.Object implements ClassFilter
RegexClassFilter is a ClassFilter
that matches class
names using a regular expression. Multiple regular expression filters
can be combined using AndClassFilter
and/or
OrClassFilter
objects.
This class does not have to load the classes it's filtering; it matches on the class name only.
RegexClassFilter uses the java.util.regex regular expression classes.
ClassFilter
,
AndClassFilter
,
OrClassFilter
,
NotClassFilter
,
ClassFinder
Constructor and Description |
---|
RegexClassFilter(java.lang.String regex)
Construct a new RegexClassFilter using the specified
pattern.
|
RegexClassFilter(java.lang.String regex,
int regexFlags)
Construct a new RegexClassFilter using the specified
pattern.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(ClassInfo classInfo,
ClassFinder classFinder)
Determine whether a class name is to be accepted or not, based on
the regular expression specified to the constructor.
|
public RegexClassFilter(java.lang.String regex) throws java.util.regex.PatternSyntaxException
regex
- the regular expression to addjava.util.regex.PatternSyntaxException
- bad regular expressionpublic RegexClassFilter(java.lang.String regex, int regexFlags) throws java.util.regex.PatternSyntaxException
regex
- the regular expression to addregexFlags
- regular expression compilation flags (e.g.,
Pattern.CASE_INSENSITIVE). See
the Javadocs for java.util.regex for
legal values.java.util.regex.PatternSyntaxException
- bad regular expressionpublic boolean accept(ClassInfo classInfo, ClassFinder classFinder)
accept
in interface ClassFilter
classInfo
- the ClassInfo
object to testclassFinder
- the invoking ClassFinder
object