public class SimpleNameFilter extends java.lang.Object implements ClassNameFilter, PackageNameFilter
SimpleClassNameFilter is a basic implementation of
the ClassNameFilter and PackageNameFilter
interface. It supports class name (ClassNameFilter) or
package prefix (PackageNameFilter) by whole name, prefix,
suffix, or substring matches.
Note that when used as a ClassNameFilter, the
packagePrefix is ignored in acceptClassName().
ClassNameFilter,
PackageNameFilter| Modifier and Type | Field and Description |
|---|---|
protected boolean |
_matchCase
Whether we are matching case (case-sensitive).
|
protected java.lang.String |
_matchName
The name that we are using for the match.
|
protected int |
_matchType
The requested match type of behavior, i.e., MATCH_WHOLE.
|
static int |
MATCH_PREFIX
Constant indicating that the name should be used for a prefix match.
|
static int |
MATCH_SUBSTRING
Constant indicating that the name should be used for a substring match.
|
static int |
MATCH_SUFFIX
Constant indicating that the name should be used for a suffix match.
|
static int |
MATCH_WHOLE
Constant indicating that the whole name should be matched
|
| Constructor and Description |
|---|
SimpleNameFilter(java.lang.String matchName,
boolean matchCase,
int matchType)
Construct a filter based on the given name, case, and type information.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptClassName(java.lang.String className,
java.lang.String packagePrefix)
Check whether the given class name should be accepted by the
filter implementation.
|
boolean |
acceptName(java.lang.String testName)
Check whether the given name (class or package name) should be
accepted by the filter implementation.
|
boolean |
acceptPackageName(java.lang.String packageName)
Check whether the given package name should be accepted by the
filter implementation.
|
boolean |
getMatchCase()
Fetch whether we are suppose to match case for the search.
|
java.lang.String |
getMatchName()
Fetch the name we are using for the match.
|
int |
getMatchType()
Fetch the match type requested.
|
void |
setMatchName(java.lang.String matchName)
Sets the text to use to determine whether a name is accepted
by the filter.
|
public static final int MATCH_WHOLE
public static final int MATCH_PREFIX
public static final int MATCH_SUBSTRING
public static final int MATCH_SUFFIX
protected int _matchType
protected boolean _matchCase
protected java.lang.String _matchName
public SimpleNameFilter(java.lang.String matchName,
boolean matchCase,
int matchType)
matchName - the name we are matchingmatchCase - whether to match case, true for case-sensitive matchesmatchType - the type of match we are performing with the name,
such as MATCH_WHOLEpublic int getMatchType()
public boolean getMatchCase()
public java.lang.String getMatchName()
public void setMatchName(java.lang.String matchName)
setMatchName in interface ClassNameFiltersetMatchName in interface PackageNameFiltermatchText - the text to matchpublic boolean acceptClassName(java.lang.String className,
java.lang.String packagePrefix)
acceptClassName in interface ClassNameFilterclassName - the unqualified class namepackagePrefix - the package prefixpublic boolean acceptPackageName(java.lang.String packageName)
acceptPackageName in interface PackageNameFilterpackageName - the package namepublic boolean acceptName(java.lang.String testName)
name - the name to search against