01: //$Id: $
02: package org.hibernate.bytecode;
03:
04: import java.security.ProtectionDomain;
05:
06: /**
07: * A persistence provider provides an instance of this interface
08: * to the PersistenceUnitInfo.addTransformer method.
09: * The supplied transformer instance will get called to transform
10: * entity class files when they are loaded and redefined. The transformation
11: * occurs before the class is defined by the JVM
12: *
13: *
14: * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
15: * @author Emmanuel Bernard
16: */
17: public interface ClassTransformer {
18: /**
19: * Invoked when a class is being loaded or redefined to add hooks for persistence bytecode manipulation
20: *
21: * @param loader the defining class loaderof the class being transformed. It may be null if using bootstrap loader
22: * @param classname The name of the class being transformed
23: * @param classBeingRedefined If an already loaded class is being redefined, then pass this as a parameter
24: * @param protectionDomain ProtectionDomain of the class being (re)-defined
25: * @param classfileBuffer The input byte buffer in class file format
26: * @return A well-formed class file that can be loaded
27: */
28: public byte[] transform(ClassLoader loader, String classname,
29: Class classBeingRedefined,
30: ProtectionDomain protectionDomain, byte[] classfileBuffer);
31: }
|