i have a test class named prova;
i want run class prova and intercept methos invocation,field reading,writing,and object instantiation.
I write this the follow code:
| try{
| javassit.reflect.Loader cl = new javassit.reflect.Loader();
| cl.makeReflective("prova","VerboseMO","javassist.reflect.ClassMetaobject");
| cl.run("prova",args);
| }
| cath(Throeable e){}
|
and the class VerboseMO:
| class VerboseMO extends Metaobject
| {
| public VerboseMO(Object base,Object args[])
| {
| super(base,args);
| System.out.println("Reflective Output: New instance of:"+base.getClass().getName()+"created");
| }
|
| public Object trapFieldRead(String name)
| {
|
| }
|
| public Object trapMethodcall(int id, Object[] args)
| {
|
| }
|
| }
|
|
this code work ,but do not know how i can intercept method call and feild call:read or write.
Can anyone help me?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876345#3876345
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876345
|