Define plugin callback method on class load by classloader (application class is loaded or reloaded by hotswap).
Method attribute types:
- byte[] - the input byte buffer in class file format - must not be modified
- ClassLoader - the defining loader of the class to be transformed,
may be
null if the bootstrap loader
- String - classname - the name of the class in the internal form of fully
qualified class and interface names. For example,
"java/util/List".
- Class - classBeingRedefined - if this is triggered by a redefine or retransform,
the class being redefined or retransformed; if this is a class load,
null
- ProtectionDomain - the protection domain of the class being defined or redefined
- ClassPool - javassist default ClassPool
- CtClass - javassist class created from byte[] source. If the method returns null/void,
this class is used as transformation result. You can modify this class directly.
- AppClassLoaderExecutor - executor to run code in app classloader
- LoadEvent - originating load event. If classBeingRedefined is null, this is DEFINE, otherwise REDEFINE.
If registered on static method, transformation is invoked even before the plugin is initialized.
You need at least one static transformation method for a plugin to trigger plugin initialization.
This event is triggered only AFTER the class is loaded by a classloader. Many frameworks like Spring or
Hibernate use custom classpath scanning to discover annotated classes. In this case a change cannot be triggered
only by @OnClassLoadEvent method (the class is never loaded) and you need to cover this case using @OnClassFileEvent
handler. See HibernatePlugin#newEntity() method annotated with OnClassFileEvent for an example.