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