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