Class MixinTargetContext
java.lang.Object
org.spongepowered.asm.mixin.transformer.MixinTargetContext
- All Implemented Interfaces:
IMixinContext
This object keeps track of data for applying a mixin to a specific target
class during a mixin application. This is a single-use object which
acts as both a handle information we need when applying the mixin (such as
the actual mixin ClassNode and the target ClassNode) and a gateway to
context-sensitive operations such as re-targetting method and field accesses
in the mixin to the appropriate members in the target class hierarchy.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionGet the class info for this classGet the mixin class nameorg.objectweb.asm.tree.ClassNodeGet the mixin treeGet the internal mixin class nameGet the defined injector group for injectorsintGet the defined value for theInject.require()parameter on injectors defined in mixins in this configuration.Get the environment of the owning mixin configGet the mixin transformer extension managerGet the injector groups for this targetintGet the max shift "by" value for the parent configintGet the minimum required class version for this mixingetMixin()Get the mixin infobooleangetOption(MixinEnvironment.Option option) Retrieve the value of the specified option from the environment this mixin belongs to.intGet the mixin priorityGet the reference mapper for this mixinGet the signature for this mixin classGet the SourceMap stratum for this mixinorg.spongepowered.asm.mixin.transformer.TargetClassContextGet the target class contextGet the target classinfoGet the target class nameorg.objectweb.asm.tree.ClassNodeGet the target classGet the target class referencegetTargetMethod(org.objectweb.asm.tree.MethodNode method) Get a target method handle from the target classbooleanGet whether overwrite annotations are required for methods in this mixinprotected voidrequireVersion(int version) Mark this mixin as requiring the specified class version in the context of the current targettoString()protected voidupgradeMethodRef(org.objectweb.asm.tree.MethodNode containingMethod, MemberRef methodRef, ClassInfo.Method method) protected void
-
Field Details
-
activities
Activity tracker
-
-
Method Details
-
toString
-
getEnvironment
Get the environment of the owning mixin config- Returns:
- mixin parent environment
-
getOption
Description copied from interface:IMixinContextRetrieve the value of the specified option from the environment this mixin belongs to.- Specified by:
getOptionin interfaceIMixinContext- Parameters:
option- option to check- Returns:
- option value
-
getClassNode
public org.objectweb.asm.tree.ClassNode getClassNode()Get the mixin tree- Returns:
- mixin tree
-
getClassName
Get the mixin class name- Specified by:
getClassNamein interfaceIMixinContext- Returns:
- the mixin class name
-
getClassRef
Description copied from interface:IMixinContextGet the internal mixin class name- Specified by:
getClassRefin interfaceIMixinContext- Returns:
- internal class name
-
getTarget
public org.spongepowered.asm.mixin.transformer.TargetClassContext getTarget()Get the target class context- Returns:
- the target class context
-
getTargetClassName
Get the target class name- Specified by:
getTargetClassNamein interfaceIMixinContext- Returns:
- target class name
-
getTargetClassRef
Get the target class reference- Specified by:
getTargetClassRefin interfaceIMixinContext- Returns:
- the reference of the target class (only valid on single-target mixins)
-
getTargetClassNode
public org.objectweb.asm.tree.ClassNode getTargetClassNode()Get the target class- Returns:
- the target class
-
getTargetClassInfo
Get the target classinfo- Returns:
- the target class info
-
getClassInfo
Get the class info for this class- Returns:
- the local class info
-
getSignature
Get the signature for this mixin class- Returns:
- signature
-
getStratum
Get the SourceMap stratum for this mixin- Returns:
- stratum
-
getMinRequiredClassVersion
public int getMinRequiredClassVersion()Get the minimum required class version for this mixin -
getDefaultRequiredInjections
public int getDefaultRequiredInjections()Get the defined value for theInject.require()parameter on injectors defined in mixins in this configuration.- Returns:
- default require value
-
getDefaultInjectorGroup
Get the defined injector group for injectors- Returns:
- default group name
-
getMaxShiftByValue
public int getMaxShiftByValue()Get the max shift "by" value for the parent config- Returns:
- max shift by value
-
getInjectorGroups
Get the injector groups for this target- Returns:
- injector groups
-
requireOverwriteAnnotations
public boolean requireOverwriteAnnotations()Get whether overwrite annotations are required for methods in this mixin- Returns:
- true if overwrite methods must be annoated with
Overwrite
-
getTargetMethod
Get a target method handle from the target class- Parameters:
method- method to get a target handle for- Returns:
- new or existing target handle for the supplied method
-
requireVersion
protected void requireVersion(int version) Mark this mixin as requiring the specified class version in the context of the current target- Parameters:
version- version to require
-
getExtensions
Description copied from interface:IMixinContextGet the mixin transformer extension manager- Specified by:
getExtensionsin interfaceIMixinContext
-
getMixin
Description copied from interface:IMixinContextGet the mixin info- Specified by:
getMixinin interfaceIMixinContext
-
getPriority
public int getPriority()Get the mixin priority- Specified by:
getPriorityin interfaceIMixinContext- Returns:
- the priority (only meaningful in relation to other mixins)
-
getReferenceMapper
Description copied from interface:IMixinContextGet the reference mapper for this mixin- Specified by:
getReferenceMapperin interfaceIMixinContext- Returns:
- ReferenceMapper instance (can be null)
-
upgradeMethods
protected void upgradeMethods() -
upgradeMethodRef
protected void upgradeMethodRef(org.objectweb.asm.tree.MethodNode containingMethod, MemberRef methodRef, ClassInfo.Method method)
-