1 package alt.jiapi.jazzpect.interceptor; 2 3 import java.lang.reflect.InvocationHandler ; 4 import java.lang.reflect.Method ; 5 6 import org.aopalliance.intercept.MethodInterceptor; 7 8 import org.apache.log4j.Category; 9 10 11 19 public class MInterceptor implements InvocationHandler { 20 private static Category log =Category.getInstance(MethodInterceptor.class); 21 private MethodInterceptor interceptor; 22 23 public MInterceptor(MethodInterceptor mi) { 24 if (mi == null) { 25 throw new NullPointerException ("MethodInterceptor may not be null"); 26 } 27 28 this.interceptor = mi; 29 } 30 31 39 public Object invoke(Object target, Method m, Object [] args) throws Throwable { 40 MethodInvocation invocation = new MethodInvocation(target, m, args); 41 42 return interceptor.invoke(invocation); 43 } 44 } 45 | Popular Tags |