Package org.spongepowered.asm.mixin.transformer

## 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
`protected ActivityStack` `activities` Activity tracker

### Method Summary

All Methods Instance Methods Concrete Methods
`ClassInfo` `getClassInfo()` Get the class info for this class
`java.lang.String` `getClassName()` Get the mixin class name
`org.objectweb.asm.tree.ClassNode` `getClassNode()` Get the mixin tree
`java.lang.String` `getClassRef()` Get the internal mixin class name
`java.lang.String` `getDefaultInjectorGroup()` Get the defined injector group for injectors
`int` `getDefaultRequiredInjections()` Get the defined value for the `Inject.require()` parameter on injectors defined in mixins in this configuration.
`MixinEnvironment` `getEnvironment()` Get the environment of the owning mixin config
`Extensions` `getExtensions()` Get the mixin transformer extension manager
`InjectorGroupInfo.Map` `getInjectorGroups()` Get the injector groups for this target
`int` `getMaxShiftByValue()` Get the max shift "by" value for the parent config
`int` `getMinRequiredClassVersion()` Get the minimum required class version for this mixin
`IMixinInfo` `getMixin()` Get the mixin info
`boolean` `getOption​(MixinEnvironment.Option option)` Retrieve the value of the specified `option` from the environment this mixin belongs to.
`int` `getPriority()` Get the mixin priority
`IReferenceMapper` `getReferenceMapper()` Get the reference mapper for this mixin
`ClassSignature` `getSignature()` Get the signature for this mixin class
`SourceMap.File` `getStratum()` Get the SourceMap stratum for this mixin
`org.spongepowered.asm.mixin.transformer.TargetClassContext` `getTarget()` Get the target class context
`ClassInfo` `getTargetClassInfo()` Get the target classinfo
`java.lang.String` `getTargetClassName()` Get the target class name
`org.objectweb.asm.tree.ClassNode` `getTargetClassNode()` Get the target class
`java.lang.String` `getTargetClassRef()` Get the target class reference
`Target` `getTargetMethod​(org.objectweb.asm.tree.MethodNode method)` Get a target method handle from the target class
`boolean` `requireOverwriteAnnotations()` Get whether overwrite annotations are required for methods in this mixin
`protected void` `requireVersion​(int version)` Mark this mixin as requiring the specified class version in the context of the current target
`java.lang.String` `toString()`
`protected void` `upgradeMethodRef​(org.objectweb.asm.tree.MethodNode containingMethod, MemberRef methodRef, ClassInfo.Method method)`
`protected void` `upgradeMethods()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### activities

    protected final ActivityStack activities

Activity tracker

### Method Detail

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### getEnvironment

    public MixinEnvironment getEnvironment()

Get the environment of the owning mixin config

Returns:
  mixin parent environment

#### getOption

    public boolean getOption​(MixinEnvironment.Option option)

Description copied from interface: `IMixinContext`
Retrieve the value of the specified `option` from the environment this mixin belongs to.

Specified by:
  `getOption` in interface `IMixinContext`
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:
  `getClassName` in interface `IMixinContext`
Returns:
  the mixin class name

#### getClassRef

    public java.lang.String getClassRef()

Description copied from interface: `IMixinContext`
Get the internal mixin class name

Specified by:
  `getClassRef` in interface `IMixinContext`
Returns:
  internal class name

#### getTarget

    public org.spongepowered.asm.mixin.transformer.TargetClassContext getTarget()

Get the target class context

Returns:
  the target class context

#### getTargetClassName

    public java.lang.String getTargetClassName()

Get the target class name

Specified by:
  `getTargetClassName` in interface `IMixinContext`
Returns:
  target class name

#### getTargetClassRef

    public java.lang.String getTargetClassRef()

Get the target class reference

Specified by:
  `getTargetClassRef` in interface `IMixinContext`
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

    public ClassInfo getTargetClassInfo()

Get the target classinfo

Returns:
  the target class info

#### getClassInfo

    public ClassInfo getClassInfo()

Get the class info for this class

Returns:
  the local class info

#### getSignature

    public ClassSignature getSignature()

Get the signature for this mixin class

Returns:
  signature

#### getStratum

    public SourceMap.File 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 the `Inject.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

    public InjectorGroupInfo.Map 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

    public Target getTargetMethod​(org.objectweb.asm.tree.MethodNode method)

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

    public Extensions getExtensions()

Description copied from interface: `IMixinContext`
Get the mixin transformer extension manager

Specified by:
  `getExtensions` in interface `IMixinContext`

#### getMixin

    public IMixinInfo getMixin()

Description copied from interface: `IMixinContext`
Get the mixin info

Specified by:
  `getMixin` in interface `IMixinContext`

#### getPriority

    public int getPriority()

Get the mixin priority

Specified by:
  `getPriority` in interface `IMixinContext`
Returns:
  the priority (only meaningful in relation to other mixins)

#### getReferenceMapper

    public IReferenceMapper getReferenceMapper()

Description copied from interface: `IMixinContext`
Get the reference mapper for this mixin

Specified by:
  `getReferenceMapper` in interface `IMixinContext`
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)