Class ProxyGenerator

java.lang.Object
io.papermc.reflectionrewriter.proxygenerator.ProxyGenerator

Generates holder classes for reflection proxy instances.
  • Method Details

    • generateProxy

      public static byte[] generateProxy(Class<?> proxyImplementation, String generatedClassName)
      Generate a holder class for the provided reflection proxy implementation.

      The holder class is constituted of an INSTANCE field for holding an instance of the reflection proxy implementation, a public static void init(ProxyImplClass proxyImplClassInstance) method to be called with reflection to initialize the holder, and for every public method on the implementation class and it's parent classes/interfaces, a static copy of the method which invokes the same method on it's INSTANCE.

      Parameters:
      proxyImplementation - proxy implementation class
      generatedClassName - name for generated class
      Returns:
      generated class bytes
    • generateProxy

      public static byte[] generateProxy(ClassReader proxyImplementation, String generatedClassName, ClassReader... parents)