Package org.stianloader.micromixin.transform.api

## Class MixinTransformer<M>

- java.lang.Object
- - org.stianloader.micromixin.transform.api.MixinTransformer<M>

- Type Parameters:
    `M` - The modularity attachment type. Modularity attachments are needed to pin down the source of a mixin. This reduces the chance of incompatibilities between mods loaded by two different classloaders. The modularity attachment should ideally implement `Object.equals(Object)` and `Object.hashCode()` if the identity comparison semantics of the default implementations are a potential issue. A recommended type can be `ClassLoader`, but really anything goes, `Void` for example is perfectly fine as long as the `BytecodeProvider` accounts for null attachments. All methods in `MixinTransformer` support null attachments internally, albeit it is not recommended to use null for any method.

      public class MixinTransformer<M>
      extends java.lang.Object

  The central brain of Micromixin. An instance of this class stores all mixin-related matters. Multiple instances can be used at the same time, as long as their inputs are separated.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MixinTransformer​(BytecodeProvider<M> bytecodeProvider, ClassWrapperPool pool)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addMixin​(M attachment, MixinConfig config)` |
    `InjectionPointSelectorFactory` | `getInjectionPointSelectors()` | Obtains the `InjectionPointSelectorFactory` that can be used to register custom injection point selectors.
    `MixinLoggingFacade` | `getLogger()` |
    `ClassWrapperPool` | `getPool()` |
    `boolean` | `isDelayingParseExceptions()` |
    `boolean` | `isMergingClassFileVersions()` |
    `boolean` | `isMixin​(M attachment, java.lang.String internalName)` | Returns whether a package or a class is within a mixin.
    `boolean` | `isMixinTarget​(java.lang.String name)` |
    `void` | `setDelayParseExceptions​(boolean delayParseExceptions)` |
    `void` | `setLogger​(MixinLoggingFacade logger)` |
    `void` | `setMergeClassFileVersions​(boolean mergeClassFileVersions)` |
    `void` | `transform​(org.objectweb.asm.tree.ClassNode in)` | Deprecated.
    `void` | `transform​(org.objectweb.asm.tree.ClassNode in, java.net.URI classCodeSourceURI)` |

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

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

- - ### Constructor Detail

    - #### MixinTransformer

          public MixinTransformer​(@NotNull
                                  BytecodeProvider<M> bytecodeProvider,
                                  @NotNull
                                  ClassWrapperPool pool)

  - ### Method Detail

    - #### addMixin

          public void addMixin​(M attachment,
                               @NotNull
                               MixinConfig config)

    - #### getInjectionPointSelectors

          @NotNull
          @Contract(pure=true)
          public InjectionPointSelectorFactory getInjectionPointSelectors()

      Obtains the `InjectionPointSelectorFactory` that can be used to register custom injection point selectors.

      The instance is specific to this specific `MixinTransformer`. Registering an injection point selector to the factory of this instance will not have an effect of any mixins registered via any other transformers.

      Returns:
        The active `InjectionPointSelectorFactory` instance.

    - #### getLogger

          @NotNull
          public MixinLoggingFacade getLogger()

    - #### getPool

          @NotNull
          public ClassWrapperPool getPool()

    - #### isDelayingParseExceptions

          public boolean isDelayingParseExceptions()

    - #### isMergingClassFileVersions

          public boolean isMergingClassFileVersions()

    - #### isMixin

          public boolean isMixin​(M attachment,
                                 @NotNull
                                 java.lang.String internalName)

      Returns whether a package or a class is within a mixin. Such classes or packages should not be loaded by the classloader.

      The internal name must be represented as a fully qualified name using slashes ('/') as package separators.

      Parameters:
        `attachment` - The modularity attachment to use
        `internalName` - The internal name of the package or class
      Returns:
        True if it is within the package, false otherwise.

    - #### isMixinTarget

          public boolean isMixinTarget​(@NotNull
                                       java.lang.String name)

    - #### setDelayParseExceptions

          public void setDelayParseExceptions​(boolean delayParseExceptions)

    - #### setLogger

          public void setLogger​(@NotNull
                                MixinLoggingFacade logger)

    - #### setMergeClassFileVersions

          public void setMergeClassFileVersions​(boolean mergeClassFileVersions)

    - #### transform

          @Deprecated
          @Obsolete
          public void transform​(@NotNull
                                org.objectweb.asm.tree.ClassNode in)

      Deprecated.

    - #### transform

          @AvailableSince("0.7.0-a20241008")
          public void transform​(@NotNull
                                org.objectweb.asm.tree.ClassNode in,
                                @Nullable
                                java.net.URI classCodeSourceURI)