Class AnnotatedMethodInfo

java.lang.Object
org.spongepowered.asm.mixin.struct.AnnotatedMethodInfo
All Implemented Interfaces:
IInjectionPointContext, ISelectorContext, IMessageSink
Direct Known Subclasses:
SpecialMethodInfo

public class AnnotatedMethodInfo extends Object implements IInjectionPointContext
Data bundle for an annotated method in a mixin
  • Field Details

    • method

      protected final org.objectweb.asm.tree.MethodNode method
      Annotated method
    • annotation

      protected final org.objectweb.asm.tree.AnnotationNode annotation
      Annotation on the method
    • annotationType

      protected final String annotationType
      Human-readable annotation type
    • methodName

      protected final String methodName
      Original name of the method, if available
  • Constructor Details

    • AnnotatedMethodInfo

      public AnnotatedMethodInfo(IMixinContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode annotation)
  • Method Details

    • getElementDescription

      public final String getElementDescription()
      Get a human-readable description of the annotation on the method for use in error messages
      Specified by:
      getElementDescription in interface ISelectorContext
    • 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!
    • getParent

      public ISelectorContext getParent()
      Description copied from interface: ISelectorContext
      Get the parent (outer/containing) context. Can be null if this is a root element such as an injector method, in which case the parent is the mixin instead.
      Specified by:
      getParent in interface ISelectorContext
    • getMixin

      public final IMixinContext getMixin()
      Get the mixin target context for this annotated method
      Specified by:
      getMixin in interface ISelectorContext
      Returns:
      the target context
    • getMethod

      public final org.objectweb.asm.tree.MethodNode getMethod()
      Get method being called
      Specified by:
      getMethod in interface IInjectionPointContext
      Specified by:
      getMethod in interface ISelectorContext
      Returns:
      injector method
    • getMethodName

      public String getMethodName()
      Get the original name of the method, if available
    • getAnnotationNode

      public org.objectweb.asm.tree.AnnotationNode getAnnotationNode()
      Get the primary annotation which makes this method special
      Specified by:
      getAnnotationNode in interface IInjectionPointContext
    • getAnnotation

      public final IAnnotationHandle getAnnotation()
      Get the primary annotation which makes this method special
      Specified by:
      getAnnotation in interface ISelectorContext
      Returns:
      The primary method annotation
    • getSelectorAnnotation

      public IAnnotationHandle getSelectorAnnotation()
      Get the annotation context for selectors operating in the context of this method.
      Specified by:
      getSelectorAnnotation in interface ISelectorContext
      Returns:
      The selector context annotation
    • getSelectorCoordinate

      public String getSelectorCoordinate(boolean leaf)
      Get the selector coordinate for this method
      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
      Returns:
      The selector context annotation
    • addMessage

      public void addMessage(String format, Object... args)
      Description copied from interface: IMessageSink
      Add a new message
      Specified by:
      addMessage in interface IMessageSink
      Parameters:
      format - Message format
      args - Message args
    • getDynamicInfo

      public static final String getDynamicInfo(Object method)
      Get info from a decorating Dynamic annotation. If the annotation is present, a descriptive string suitable for inclusion in an error message is returned. If the annotation is not present then an empty string is returned.
      Parameters:
      method - method to inspect
    • getDynamicInfo

      public static final String getDynamicInfo(org.objectweb.asm.tree.MethodNode method)
      Get info from a decorating Dynamic annotation. If the annotation is present, a descriptive string suitable for inclusion in an error message is returned. If the annotation is not present then an empty string is returned.
      Parameters:
      method - method to inspect
    • getDynamicInfo

      public static final String getDynamicInfo(IAnnotatedElement method)
      Get info from a decorating Dynamic annotation. If the annotation is present, a descriptive string suitable for inclusion in an error message is returned. If the annotation is not present then an empty string is returned.
      Parameters:
      method - method to inspect