[jboss-user] [JBoss AOP] - Re: Acting on class load
fbrueseke
do-not-reply at jboss.com
Wed Oct 29 08:22:06 EDT 2008
Thanks for the quick answer.
So what I would have to do is:
- Implement my own class that conforms to the interface "java.lang.instrument.ClassFileTransformer"
- Register an object of that class with the PluggableInstrumentor
and then I'm ready to go?
So in code:
public class MyTransformer implements ClassFileTransformer
| {
| public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined,
| ProtectionDomain protectionDomain, byte[] classfileBuffer)
| throws IllegalClassFormatException
| {
| //do something ...
| }
| }
| public class someOtherClass
| { //all static for simplicity
| public static MyTransformer transformer= new MyTransformer();
| static{
| PluggableInstrumentor.getInstrumentor().addTransformer(transformer)
| }
| }
Is that correct?
Kind regards
Frank
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4185369#4185369
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4185369
More information about the jboss-user
mailing list