Interface Transformer

All Known Implementing Classes:
BukkitCommodoreTransformer, BukkitJavaVersionCheckTransformer, KnotClassDelegateTransformer, OldEpollDisableTransformer, PaperConfigTransformer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Transformer
A transformer for classes which are being loaded during the runtime. A transformer which is registered to a transformer registry gets called BEFORE a class definition, making it able to change the class as required. Class re-transformations are not posted to transformers.
Since:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    transform(@NonNull String classname, @NonNull org.objectweb.asm.tree.ClassNode classNode)
    Applies the transformation to the given class node.
  • Method Details

    • transform

      void transform(@NonNull @NonNull String classname, @NonNull @NonNull org.objectweb.asm.tree.ClassNode classNode)
      Applies the transformation to the given class node. The passed in class node will get re-encoded and represents the class after transformation (and therefore will be the final defined class).

      This transformer is only called once, after that this transformer will automatically get removed from the registered transformers (as the class is defined and transformers will never handle re-transformations).

      Parameters:
      classname - the fully qualified name of the transforming class.
      classNode - the class node in its original form, before any transformation was applied to it.
      Throws:
      NullPointerException - if the given class name or class node is null.