blob: a9f75dd1b5f0f350be5d04cbfcb784b04b631d05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package sample.reflect;
import javassist.*;
import javassist.reflect.*;
public class VerboseMetaobj extends Metaobject {
public VerboseMetaobj(Object self, Object[] args) {
super(self, args);
System.out.println("** constructed: " + self.getClass().getName());
}
public Object trapFieldRead(String name) {
System.out.println("** field read: " + name);
return super.trapFieldRead(name);
}
public void trapFieldWrite(String name, Object value) {
System.out.println("** field write: " + name);
super.trapFieldWrite(name, value);
}
public Object trapMethodcall(int identifier, Object[] args)
throws Throwable
{
System.out.println("** trap: " + getMethodName(identifier)
+ "() in " + getClassMetaobject().getName());
return super.trapMethodcall(identifier, args);
}
}
|