|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface for transforming byte code before Class creation. This is compatible with the JDK1.5 java.lang.instrument.ClassFileTransformer proposal.
Method Summary | |
byte[] |
transform(ClassLoader loader,
String className,
Class classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer)
Optionally transform the supplied class file and return a new replacement class file. |
void |
unregisterClassLoader(ClassLoader loader)
Called to indicate that the ClassLoader is being discarded by the server. |
Method Detail |
public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws Exception
If a transformer has been registered with the class loading layer,
the transformer will be called for every new class definition.
The request for a new class definition is made with
ClassLoader.defineClass
.
The transformer is called during the processing of the request, before
the class file bytes have been verified or applied.
If the implementing method determines that no transformations are needed,
it should return null
. Otherwise, it should create a new
byte[] array and copy the input classfileBuffer
into it,
along with all desired transformations. The input classfileBuffer
must not be modified.
loader
- - the defining loader of the class to be transformed, may
be null
if the bootstrap loaderclassName
- - the fully-qualified name of the classclassBeingRedefined
- - if this is a redefine, the class being
redefined, otherwise null
protectionDomain
- - the protection domain of the class being
defined or redefinedclassfileBuffer
- - the input byte buffer in class file format - must
not be modified
null
if no transform is performed.
Exception
- - if the input does not represent a well-formed class filepublic void unregisterClassLoader(ClassLoader loader)
loader
- - a class loader that has possibly been used previously
as an argument to transform.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |