Class ProxyGenerator
java.lang.Object
io.papermc.reflectionrewriter.proxygenerator.ProxyGenerator
@DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class)
public final class ProxyGenerator
extends Object
Generates holder classes for reflection proxy instances.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]generateProxy(Class<?> proxyImplementation, String generatedClassName) Generate a holder class for the provided reflection proxy implementation.static byte[]generateProxy(ClassReader proxyImplementation, String generatedClassName, ClassReader... parents)
-
Method Details
-
generateProxy
Generate a holder class for the provided reflection proxy implementation.The holder class is constituted of an
INSTANCEfield for holding an instance of the reflection proxy implementation, apublic 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'sINSTANCE.- Parameters:
proxyImplementation- proxy implementation classgeneratedClassName- name for generated class- Returns:
- generated class bytes
-
generateProxy
public static byte[] generateProxy(ClassReader proxyImplementation, String generatedClassName, ClassReader... parents)
-