public class Transformer extends Object
Constructor and Description |
---|
Transformer() |
Modifier and Type | Method and Description |
---|---|
void |
loadRules(ClassLoader cl) |
void |
loadRules(Collection<? extends ClassLoader> loaders)
Scans the rewrite instructions and prepare to rewrite classes that refer to them
accordingly.
|
byte[] |
transform(String className,
byte[] image)
Transforms a class file.
|
public void loadRules(ClassLoader cl) throws IOException
IOException
public void loadRules(Collection<? extends ClassLoader> loaders) throws IOException
The effects of this method is cumulative. The added rules are stored on top of what's already in this transformer. This method is concurrency safe, and can be invoked even when Transformer is already being in use.
IOException
public byte[] transform(String className, byte[] image)
className
- Binary name of the class, such as "java.security.KeyStore$Builder$FileBuilder$1"image
- Class file image loaded from the disk.Copyright © 2016. All rights reserved.