public class PatternMatchNameFilter extends SimpleNameFilter
PatternMatchNameFilter
handles name matching for both class and package names. It supports pattern matching for question mark (?) and asterisk (*) characters. Use a question mark to match any single character, or an asterisk to match any number of characters.
For class name matching, it also supports camel-case matching.
Here are some sample results for various search strings. (Note, the results include interfaces only, no classes and no packages.)
Search Text | Sample Result |
---|---|
*wil | javax.swing.event.TreeWillExpandListener |
wil | No matches |
WiLi | sun.awt.WindowClosingListener java.awt.event.WindowFocusListener java.awt.event.WindowListener java.awt.event.WindowStateListener |
w?n | sun.awt.WindowClosingListener sun.awt.WindowClosingSupport javax.swing.WindowConstants java.awt.event.WindowFocusListener java.awt.event.WindowListener java.awt.peer.WindowPeer java.awt.event.WindowStateListener |
ClassNameFilter
, PackageNameFilter
, CamelCaseFilter
_matchCase, _matchName, _matchType, MATCH_PREFIX, MATCH_SUBSTRING, MATCH_SUFFIX, MATCH_WHOLE
Constructor and Description |
---|
PatternMatchNameFilter()
Constructs a
PatternMatchNameFilter to match names by prefix. |
PatternMatchNameFilter(boolean matchSubString)
Constructs a
PatternMatchNameFilter . |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptClassName(java.lang.String className, java.lang.String packagePrefix)
Check whether the given class name matches the search criteria.
|
boolean |
acceptPackageName(java.lang.String packageName)
Check whether the given package name should be accepted by the filter implementation.
|
void |
setMatchName(java.lang.String criteria)
Sets the text to use as match criteria.
|
void |
setMatchSubstring(boolean matchSubString)
Sets the match method to use, either matching the prefix, or matching any part of the name.
|
acceptName, getMatchCase, getMatchName, getMatchType
public PatternMatchNameFilter()
PatternMatchNameFilter
to match names by prefix. By default the match critieria is an empty String.public PatternMatchNameFilter(boolean matchSubString)
PatternMatchNameFilter
. By default the match critieria is an empty String.matchSubstring
- if true
, a name is accepted if any part of it matches the search text, otherwise, the name must begin with the search textpublic void setMatchName(java.lang.String criteria)
setMatchName
in interface ClassNameFilter
setMatchName
in interface PackageNameFilter
setMatchName
in class SimpleNameFilter
criteria
- the text to matchpublic void setMatchSubstring(boolean matchSubString)
matchSubstring
- if true
, a name is accepted if any part of it matches the search text, otherwise, the name must begin with the search textpublic boolean acceptPackageName(java.lang.String packageName)
acceptPackageName
in interface PackageNameFilter
acceptPackageName
in class SimpleNameFilter
packageName
- the package namepublic boolean acceptClassName(java.lang.String className, java.lang.String packagePrefix)
acceptClassName
in interface ClassNameFilter
acceptClassName
in class SimpleNameFilter
className
- the unqualified class namepackagePrefix
- the package prefix