Class SelectorAnnotationContext

java.lang.Object
org.spongepowered.asm.mixin.injection.struct.SelectorAnnotationContext
All Implemented Interfaces:
ISelectorContext
Direct Known Subclasses:
InjectionPointAnnotationContext

public class SelectorAnnotationContext extends Object implements ISelectorContext
Narrowed context for selectors in annotations which are themselves inside a parent annotation, for example @At annotations within a parent @Inject annotation.
  • Constructor Details

    • SelectorAnnotationContext

      public SelectorAnnotationContext(ISelectorContext parent, IAnnotationHandle selectorAnnotation, String selectorCoordinate)
      Create a specialised context for a child annotation
      Parameters:
      parent - Parent selector context, eg. context of the outer element such as @Inject
      selectorAnnotation - Annotation for this selector, eg. @At
      selectorCoordinate - Coordinate for this selector
  • Method Details

    • getParent

      public ISelectorContext getParent()
      Get the parent of this selector, must not return null
      Specified by:
      getParent in interface ISelectorContext
      Returns:
      parent context
    • getMixin

      public IMixinContext getMixin()
      Description copied from interface: ISelectorContext
      Get the mixin containing this selector.
      Specified by:
      getMixin in interface ISelectorContext
    • getMethod

      public Object getMethod()
      Description copied from interface: ISelectorContext
      Get the root method upon which this selector is operating, usually the injector method
      Specified by:
      getMethod in interface ISelectorContext
    • getAnnotation

      public IAnnotationHandle getAnnotation()
      Description copied from interface: ISelectorContext
      Get the root annotation for the selector, for example the injector or accessor annotation
      Specified by:
      getAnnotation in interface ISelectorContext
    • getSelectorAnnotation

      public IAnnotationHandle getSelectorAnnotation()
      Description copied from interface: ISelectorContext
      Get the annotation for this selector, for example the @At annotation
      Specified by:
      getSelectorAnnotation in interface ISelectorContext
    • getSelectorCoordinate

      public String getSelectorCoordinate(boolean leaf)
      Description copied from interface: ISelectorContext
      Get the coordinate for this selector. This is the local coordinate of the selector without any parent parts. Parent parts are prepended by consumers during the resolve process.
      Specified by:
      getSelectorCoordinate in interface ISelectorContext
      Parameters:
      leaf - True if getting the coordinate when this element is a leaf, false if getting the coordinate when it is a parent
    • remap

      public String remap(String reference)
      Description copied from interface: ISelectorContext
      Remap a reference in the context of this selector, usually via the local refmap of the mixin configuration but can be overridden as needed, for example to provide selector-local remap behaviour.
      Specified by:
      remap in interface ISelectorContext
      Parameters:
      reference - Reference to remap
      Returns:
      Remapped reference or original reference if not remapped, must not return null!
    • getElementDescription

      public String getElementDescription()
      Description copied from interface: ISelectorContext
      Get a human-readable description of the annotation on the method for use in error messages
      Specified by:
      getElementDescription in interface ISelectorContext