public interface ITargetSelector
Explicit Target Selectors are handled internally using
MemberInfo structs, see the javadoc for MemberInfo for the
supported variants and examples.
// An example explicit target selector
Lfully/qualified/OwnerClass;methodName*(III)V
Pattern Target Selectors are handled internally using
MemberMatcher, see the javadoc for MemberMatcher for the
supported variants and examples. Pattern Selectors always end with a forward
slash character.
// 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/
Dynamic Target Selectors can be built-in or user-supplied types with their own specialised syntax or behaviour.
@Desc Selector: Selector which uses
descriptors defined in @Desc annotationsDynamic selectors are specified in the following format, and can be recognised by the fact that the selector string starts with "@":
// Built-in dynamic selector without argument string@SelectorId// Built-in dynamic selector with empty argument string@SelectorId()// Built-in dynamic selector with argument@SelectorId(custom,argument,string,in,any,format)// User-provided dynamic selector with argument. Note that // user-provided dynamic selectors are namespaced to avoid conflicts.@Namespace:SelectorId(some arguments)
The exact format of the argument string is specified by the dynamic selector itself, consult the documentation for the dynamic selector you are using for details on the required format.
| Modifier and Type | Interface and Description |
|---|---|
static class |
ITargetSelector.Configure
Available selector reconfigurations
|
| 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.
|
ITargetSelector |
validate()
Perform basic sanity-check validation of the selector, checks that the
parsed out parameters are basically sane
|
ITargetSelector next()
Can return null
ITargetSelector configure(ITargetSelector.Configure request, java.lang.String... args)
In 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.
request - Requested operationargs - Configuration argumentsITargetSelector validate() throws InvalidSelectorException
InvalidSelectorException - if any sanity check failsITargetSelector attach(ISelectorContext context) throws InvalidSelectorException
InvalidSelectorException is thrown.context - Context to attach toInvalidSelectorExceptionint getMinMatchCount()
int getMaxMatchCount()
<TNode> MatchResult match(ElementNode<TNode> node)
TNode - node typenode - node node to test