1 22 package org.jboss.test.aop.field; 23 24 import org.jboss.aop.advice.Interceptor; 25 import org.jboss.aop.joinpoint.FieldReadInvocation; 26 import org.jboss.aop.joinpoint.Invocation; 27 28 33 public class TraceInterceptor implements Interceptor 34 { 35 36 public String getName() 37 { 38 return "TraceInterceptor"; 39 } 40 41 public Object invoke(Invocation invocation) throws Throwable 42 { 43 String msg = null; 44 if (invocation instanceof FieldReadInvocation) 45 { 46 msg = "read field name: " + ((FieldReadInvocation)invocation).getField(); 47 } 48 49 try 50 { 51 System.out.println("<<< Trace : " + msg); 52 return invocation.invokeNext(); 53 } 54 finally 55 { 56 System.out.println(">>> Leaving Trace"); 57 } 58 } 59 60 } 61 | Popular Tags |