Interface ITargetSelector

All Known Subinterfaces:
ITargetSelectorByName, ITargetSelectorConstructor, ITargetSelectorRemappable
All Known Implementing Classes:
MemberInfo

public interface ITargetSelector
Target Selectors are used to identify target members in a class, with the criteria for selection being specified in a single string, effectively defining the query parameters. They are used by injectors and other components which need to identify a target element using a string.

Explicit Target Selectors

Explicit Target Selectors are handled internally using MemberInfo structs, see the javadoc for MemberInfo for the supported variants and examples.

  • Method Summary

    Modifier and Type Method Description
    ITargetSelector attach​(IMixinContext context)
    Attach this selector to the specified context.
    ITargetSelector configure​(java.lang.String... args)
    Configure and return a modified version of this selector by consuming the supplied arguments.
    int getMatchCount()
    Number of candidates which this selector should match
    MatchResult match​(org.objectweb.asm.tree.AbstractInsnNode insn)
    Test whether this selector matches the supplied instruction node
    <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
  • Method Details

    • next

      Get the next target selector in this path (or null if this selector is the last selector in the chain. Called at recurse points in the subject in order to match against the child subject.
    • configure

      ITargetSelector configure​(java.lang.String... args)
      Configure and return a modified version of this selector by consuming the supplied arguments. Results from this method should be idempotent in terms of the configuration of the returned object, but do not have to necessarily return the same object if the callee already matches the supplied configuration, though this is generally the case.

      In other words, calling configure("foo") when this object is already configured according to "foo" may simply return this object, or might return an identically-configured copy.

      Parameters:
      args - Configuration arguments
      Returns:
      Configured selector, may return this selector if the specified condition is already satisfied
    • validate

      Perform basic sanity-check validation of the selector, checks that the parsed out parameters are basically sane
      Returns:
      fluent (this selector)
      Throws:
      InvalidSelectorException - if any sanity check fails
    • attach

      Attach this selector to the specified context. Should return this selector unmodified if all is well, or a new selector to be used for further processing of the supplied context. If the supplied context is invalid, an InvalidSelectorException is thrown.
      Parameters:
      context - Context to attach to
      Returns:
      Attached selector
      Throws:
      InvalidSelectorException
    • getMatchCount

      int getMatchCount()
      Number of candidates which this selector should match
    • match

      <TNode> MatchResult match​(ElementNode<TNode> node)
      Test whether this selector matches the supplied element node
      Type Parameters:
      TNode - node type
      Parameters:
      node - node node to test
      Returns:
      true if this selector can match the supplied field
    • match

      MatchResult match​(org.objectweb.asm.tree.AbstractInsnNode insn)
      Test whether this selector matches the supplied instruction node
      Parameters:
      insn - instruction node to test
      Returns:
      true if this selector can match the supplied instruction