public interface Translator
Modifier and Type | Method and Description |
---|---|
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.
|
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 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 modifiednull
if no transform is performed.Exception
- - if the input does not represent a well-formed class filevoid unregisterClassLoader(ClassLoader loader)
loader
- - a class loader that has possibly been used previously
as an argument to transform.Copyright © 2018 JBoss by Red Hat. All rights reserved.