Package org.stianloader.micromixin.transform.internal

## Class HandlerContextHelper

- java.lang.Object
- - org.stianloader.micromixin.transform.internal.HandlerContextHelper

    public class HandlerContextHelper
    extends java.lang.Object

### Field Summary

Fields
`MultiplexLineNumberAllocator` `lineAllocator`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static HandlerContextHelper` `from​(org.objectweb.asm.tree.ClassNode node)`
`java.lang.String` `generateUniqueLocalPrefix()` Generate a unique prefix for a mixin handler method.
`java.lang.String` `getBridgePrefix()` The bridge prefix is a prefix that is applied on all mixin-introduced bridge methods for a given target class.
`java.lang.String` `getBridgeSuffix()` The bridge suffix is a string that is attached to the end of a bridge method's name to ensure that the bridge method is named uniquely among any other method with the same `bridge prefix`.

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

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

### Field Detail

#### lineAllocator

    @NotNull
    public final MultiplexLineNumberAllocator lineAllocator

### Method Detail

#### from

    @NotNull
    public static HandlerContextHelper from​(@NotNull
                                            org.objectweb.asm.tree.ClassNode node)

#### generateUniqueLocalPrefix

    @NotNull
    public java.lang.String generateUniqueLocalPrefix()

Generate a unique prefix for a mixin handler method. This prefix contains a trailing "$"

The intention of this prefix is to prevent multiple mixins defining mixin handlers with the same name causing classes to be transformed invalidly.

Returns:
  A unique prefix applied on the mixin handler method that is copied to the target (transformed) class.

#### getBridgePrefix

    @NotNull
    @Contract(pure=true)
    public java.lang.String getBridgePrefix()

The bridge prefix is a prefix that is applied on all mixin-introduced bridge methods for a given target class. Bridge methods are generated when using `WrapOperation` because the `Operation` class accepts a `Object[]` but the arguments need to be spread/unboxed from the array for the underlying operation to succeed.

The prefix will be the same for all mixins applied with this `HandlerContextHelper`, which is usually generated for each call for `MixinTransformer.transform(ClassNode)`, meaning that different mixin classes will share the same bridge prefix for as long as they target the same class within the same session (unless multiple calls to `MixinTransformer.transform(ClassNode)`) are dispatched.

The main intention of this field is to prevent collisions between mixins when transforming a class with mixin transformers multiple times.

Whilst the bridge prefix ensures uniqueness across multiple transformations, the bridge suffix is required for uniqueness within a single transformation.

Returns:
  The bridge prefix of this `HandlerContextHelper` instance. It is constant for every invocation of this method on a given `HandlerContextHelper` instance.
See Also:
  `getBridgeSuffix()`

#### getBridgeSuffix

    @NotNull
    @Contract(pure=false,
              mutates="this",
              value="-> new")
    public java.lang.String getBridgeSuffix()

The bridge suffix is a string that is attached to the end of a bridge method's name to ensure that the bridge method is named uniquely among any other method with the same `bridge prefix`.

Returns:
  A generated `String` that is unique for every invocation of this method for this `HandlerContextHelper` instance.
See Also:
  `getBridgePrefix()`