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 java.lang.Object implements IInjectionPointContext
Data bundle for an annotated method in a mixin
-
-
Field Summary
Fields Modifier and Type Field Description protected org.objectweb.asm.tree.AnnotationNodeannotationAnnotation on the methodprotected java.lang.StringannotationTypeHuman-readable annotation typeprotected org.objectweb.asm.tree.MethodNodemethodAnnotated methodprotected java.lang.StringmethodNameOriginal name of the method, if available
-
Constructor Summary
Constructors Constructor Description AnnotatedMethodInfo(IMixinContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode annotation)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(java.lang.String format, java.lang.Object... args)Add a new messageIAnnotationHandlegetAnnotation()Get the primary annotation which makes this method specialorg.objectweb.asm.tree.AnnotationNodegetAnnotationNode()Get the primary annotation which makes this method specialstatic java.lang.StringgetDynamicInfo(java.lang.Object method)Get info from a decoratingDynamicannotation.static java.lang.StringgetDynamicInfo(org.objectweb.asm.tree.MethodNode method)Get info from a decoratingDynamicannotation.static java.lang.StringgetDynamicInfo(IAnnotatedElement method)Get info from a decoratingDynamicannotation.java.lang.StringgetElementDescription()Get a human-readable description of the annotation on the method for use in error messagesorg.objectweb.asm.tree.MethodNodegetMethod()Get method being calledjava.lang.StringgetMethodName()Get the original name of the method, if availableIMixinContextgetMixin()Get the mixin target context for this annotated methodISelectorContextgetParent()Get the parent (outer/containing) context.IAnnotationHandlegetSelectorAnnotation()Get the annotation context for selectors operating in the context of this method.java.lang.StringgetSelectorCoordinate(boolean leaf)Get the selector coordinate for this methodjava.lang.Stringremap(java.lang.String reference)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.
-
-
-
Field Detail
-
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 java.lang.String annotationType
Human-readable annotation type
-
methodName
protected final java.lang.String methodName
Original name of the method, if available
-
-
Constructor Detail
-
AnnotatedMethodInfo
public AnnotatedMethodInfo(IMixinContext mixin, org.objectweb.asm.tree.MethodNode method, org.objectweb.asm.tree.AnnotationNode annotation)
-
-
Method Detail
-
getElementDescription
public final java.lang.String getElementDescription()
Get a human-readable description of the annotation on the method for use in error messages- Specified by:
getElementDescriptionin interfaceISelectorContext
-
remap
public java.lang.String remap(java.lang.String reference)
Description copied from interface:ISelectorContextRemap 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:
remapin interfaceISelectorContext- 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:ISelectorContextGet 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:
getParentin interfaceISelectorContext
-
getMixin
public final IMixinContext getMixin()
Get the mixin target context for this annotated method- Specified by:
getMixinin interfaceISelectorContext- Returns:
- the target context
-
getMethod
public final org.objectweb.asm.tree.MethodNode getMethod()
Get method being called- Specified by:
getMethodin interfaceIInjectionPointContext- Specified by:
getMethodin interfaceISelectorContext- Returns:
- injector method
-
getMethodName
public java.lang.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:
getAnnotationNodein interfaceIInjectionPointContext
-
getAnnotation
public final IAnnotationHandle getAnnotation()
Get the primary annotation which makes this method special- Specified by:
getAnnotationin interfaceISelectorContext- Returns:
- The primary method annotation
-
getSelectorAnnotation
public IAnnotationHandle getSelectorAnnotation()
Get the annotation context for selectors operating in the context of this method.- Specified by:
getSelectorAnnotationin interfaceISelectorContext- Returns:
- The selector context annotation
-
getSelectorCoordinate
public java.lang.String getSelectorCoordinate(boolean leaf)
Get the selector coordinate for this method- Specified by:
getSelectorCoordinatein interfaceISelectorContext- 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(java.lang.String format, java.lang.Object... args)Description copied from interface:IMessageSinkAdd a new message- Specified by:
addMessagein interfaceIMessageSink- Parameters:
format- Message formatargs- Message args
-
getDynamicInfo
public static final java.lang.String getDynamicInfo(java.lang.Object method)
Get info from a decoratingDynamicannotation. 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 java.lang.String getDynamicInfo(org.objectweb.asm.tree.MethodNode method)
Get info from a decoratingDynamicannotation. 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 java.lang.String getDynamicInfo(IAnnotatedElement method)
Get info from a decoratingDynamicannotation. 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
-
-