ClassTransformer (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.persistence.spi Interface ClassTransformer


public interface ClassTransformer

A persistence provider supplies an instance of this interface to the PersistenceUnitInfo.addTransformer method. The supplied transformer instance will get called to transform entity class files when they are loaded or redefined. The transformation occurs before the class is defined by the JVM.

从以下版本开始:
Java Persistence 1.0

方法摘要
 byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)
          Invoked when a class is being loaded or redefined.
 

方法详细信息

transform

byte[] transform(ClassLoader loader,
                 String className,
                 Class<?> classBeingRedefined,
                 ProtectionDomain protectionDomain,
                 byte[] classfileBuffer)
                 throws IllegalClassFormatException
Invoked when a class is being loaded or redefined. The implementation of this method may transform the supplied class file and return a new replacement class file.

参数:
loader - The defining loader of the class to be transformed, may be null if the bootstrap loader
className - The name of the class in the internal form of fully qualified class and interface names
classBeingRedefined - If this is a redefine, the class being redefined, otherwise null
protectionDomain - The protection domain of the class being defined or redefined
classfileBuffer - The input byte buffer in class file format - must not be modified
返回:
A well-formed class file buffer (the result of the transform), or null if no transform is performed
抛出异常:
IllegalClassFormatException - If the input does not represent a well-formed class file

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.