Class MixinTargetContext
java.lang.Object
org.spongepowered.asm.mixin.transformer.MixinTargetContext
- All Implemented Interfaces:
IMixinContext
public class MixinTargetContext extends java.lang.Object implements 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 Modifier and Type Field Description protected ActivityStackactivitiesActivity tracker -
Method Summary
Modifier and Type Method Description ClassInfogetClassInfo()Get the class info for this classjava.lang.StringgetClassName()Get the mixin class nameorg.objectweb.asm.tree.ClassNodegetClassNode()Get the mixin treejava.lang.StringgetClassRef()Get the internal mixin class namejava.lang.StringgetDefaultInjectorGroup()Get the defined injector group for injectorsintgetDefaultRequiredInjections()Get the defined value for theInject.require()parameter on injectors defined in mixins in this configuration.MixinEnvironmentgetEnvironment()Get the environment of the owning mixin configExtensionsgetExtensions()Get the mixin transformer extension managerInjectorGroupInfo.MapgetInjectorGroups()Get the injector groups for this targetintgetMaxShiftByValue()Get the max shift "by" value for the parent configintgetMinRequiredClassVersion()Get the minimum required class version for this mixinIMixinInfogetMixin()Get the mixin infobooleangetOption(MixinEnvironment.Option option)Retrieve the value of the specified option from the environment this mixin belongs to.intgetPriority()Get the mixin priorityIReferenceMappergetReferenceMapper()Get the reference mapper for this mixinClassSignaturegetSignature()Get the signature for this mixin classSourceMap.FilegetStratum()Get the SourceMap stratum for this mixinorg.spongepowered.asm.mixin.transformer.TargetClassContextgetTarget()Get the target class contextClassInfogetTargetClassInfo()Get the target classinfoorg.objectweb.asm.tree.ClassNodegetTargetClassNode()Get the target classjava.lang.StringgetTargetClassRef()Get the target class referenceTargetgetTargetMethod(org.objectweb.asm.tree.MethodNode method)Get a target method handle from the target classbooleanrequireOverwriteAnnotations()Get 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 targetjava.lang.StringtoString()protected voidupgradeMethodRef(org.objectweb.asm.tree.MethodNode containingMethod, MemberRef methodRef, ClassInfo.Method method)protected voidupgradeMethods()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
activities
Activity tracker
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
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
public java.lang.String getClassName()Get the mixin class name- Specified by:
getClassNamein interfaceIMixinContext- Returns:
- the mixin class name
-
getClassRef
public java.lang.String 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
-
getTargetClassRef
public java.lang.String 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
public java.lang.String 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- Specified by:
getTargetMethodin interfaceIMixinContext- 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)
-