Class SelectorAnnotationContext
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.struct.SelectorAnnotationContext
-
- All Implemented Interfaces:
ISelectorContext
- Direct Known Subclasses:
InjectionPointAnnotationContext
public class SelectorAnnotationContext extends java.lang.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 Summary
Constructors Constructor Description SelectorAnnotationContext(ISelectorContext parent, IAnnotationHandle selectorAnnotation, java.lang.String selectorCoordinate)Create a specialised context for a child annotation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IAnnotationHandlegetAnnotation()Get the root annotation for the selector, for example the injector or accessor annotationjava.lang.StringgetElementDescription()Get a human-readable description of the annotation on the method for use in error messagesjava.lang.ObjectgetMethod()Get the root method upon which this selector is operating, usually the injector methodIMixinContextgetMixin()Get the mixin containing this selector.ISelectorContextgetParent()Get the parent of this selector, must not return nullIAnnotationHandlegetSelectorAnnotation()Get the annotation for this selector, for example the @At annotationjava.lang.StringgetSelectorCoordinate(boolean leaf)Get the coordinate for this selector.java.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.
-
-
-
Constructor Detail
-
SelectorAnnotationContext
public SelectorAnnotationContext(ISelectorContext parent, IAnnotationHandle selectorAnnotation, java.lang.String selectorCoordinate)
Create a specialised context for a child annotation- Parameters:
parent- Parent selector context, eg. context of the outer element such as @InjectselectorAnnotation- Annotation for this selector, eg. @AtselectorCoordinate- Coordinate for this selector
-
-
Method Detail
-
getParent
public ISelectorContext getParent()
Get the parent of this selector, must not return null- Specified by:
getParentin interfaceISelectorContext- Returns:
- parent context
-
getMixin
public IMixinContext getMixin()
Description copied from interface:ISelectorContextGet the mixin containing this selector.- Specified by:
getMixinin interfaceISelectorContext
-
getMethod
public java.lang.Object getMethod()
Description copied from interface:ISelectorContextGet the root method upon which this selector is operating, usually the injector method- Specified by:
getMethodin interfaceISelectorContext
-
getAnnotation
public IAnnotationHandle getAnnotation()
Description copied from interface:ISelectorContextGet the root annotation for the selector, for example the injector or accessor annotation- Specified by:
getAnnotationin interfaceISelectorContext
-
getSelectorAnnotation
public IAnnotationHandle getSelectorAnnotation()
Description copied from interface:ISelectorContextGet the annotation for this selector, for example the @At annotation- Specified by:
getSelectorAnnotationin interfaceISelectorContext
-
getSelectorCoordinate
public java.lang.String getSelectorCoordinate(boolean leaf)
Description copied from interface:ISelectorContextGet 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:
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
-
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!
-
getElementDescription
public java.lang.String getElementDescription()
Description copied from interface:ISelectorContextGet a human-readable description of the annotation on the method for use in error messages- Specified by:
getElementDescriptionin interfaceISelectorContext
-
-