public final class MemberMatcher extends java.lang.Object implements ITargetSelector
Target Selector which matches an element of
candidate members using a regular expression. This selector is not remappable
and is not suitable for use in obfuscated environments.
Regular expressions for this selector should be enclosed in / as a delimiter character, and \ characters must be escaped per normal Java conventions (eg. use \\s instead of \s since the backslash must be escaped). Forward slash (/) characters in the regex must be escaped as well to avoid being consumed as ending delimiters.
By default the regex match is performed against the name of the candidate, to specify matching against owner or desc, each pattern should be prefixed with owner= or desc= outside the delimiting /.
Some examples:
// Matches candidates starting with "foo"/^foo/// Matches candidates ending with "Bar" and which take a single int/bar$/ desc=/^\\(I\\)/// The same example but with "name" explicitly specified (optional)name=/bar$/ desc=/^\\(I\\)/// Matches candidates whose name contains "Entity"/Entity/// Matches candidates whose owner contains "/google/", note the // escaping of the forward slash symbolsowner=/\\/google\\//
The owner, name and desc expressions can be provided in any order.
ITargetSelector.Configure| Modifier and Type | Method and Description |
|---|---|
ITargetSelector |
attach(ISelectorContext context)
Attach this selector to the specified context.
|
ITargetSelector |
configure(ITargetSelector.Configure request,
java.lang.String... args)
Configure and return a modified version of this selector by consuming the
supplied arguments.
|
int |
getMaxMatchCount()
Maximum number of candidates this selector can match
|
int |
getMinMatchCount()
Minimum number of candidates this selector must match
|
<TNode> MatchResult |
match(ElementNode<TNode> node)
Test whether this selector matches the supplied element node
|
ITargetSelector |
next()
Get the next target selector in this path (or null if this
selector is the last selector in the chain.
|
static MemberMatcher |
parse(java.lang.String input,
ISelectorContext context)
Parse a MemberMatcher from the supplied input string.
|
java.lang.String |
toString() |
ITargetSelector |
validate()
Perform basic sanity-check validation of the selector, checks that the
parsed out parameters are basically sane
|
public static MemberMatcher parse(java.lang.String input, ISelectorContext context)
input - Raw input stringcontext - selector contextpublic ITargetSelector validate() throws InvalidSelectorException
ITargetSelectorvalidate in interface ITargetSelectorInvalidSelectorException - if any sanity check failspublic java.lang.String toString()
toString in class java.lang.Objectpublic ITargetSelector next()
ITargetSelectorCan return null
next in interface ITargetSelectorpublic ITargetSelector configure(ITargetSelector.Configure request, java.lang.String... args)
ITargetSelectorIn other words, calling configure(Configure.ORPHAN) when this object is already an orphan or does not support orphaning, may simply return this object, or might return an identically-configured copy.
Must not return null, defaults to returning unmodified selector.
configure in interface ITargetSelectorrequest - Requested operationargs - Configuration argumentspublic ITargetSelector attach(ISelectorContext context) throws InvalidSelectorException
ITargetSelectorInvalidSelectorException is thrown.attach in interface ITargetSelectorcontext - Context to attach toInvalidSelectorExceptionpublic int getMinMatchCount()
ITargetSelectorgetMinMatchCount in interface ITargetSelectorpublic int getMaxMatchCount()
ITargetSelectorgetMaxMatchCount in interface ITargetSelectorpublic <TNode> MatchResult match(ElementNode<TNode> node)
ITargetSelectormatch in interface ITargetSelectorTNode - node typenode - node node to test