1 22 package org.jboss.test.aop.override; 23 24 import org.jboss.aop.advice.Interceptor; 25 import org.jboss.aop.joinpoint.Invocation; 26 27 33 public class CountingInterceptor implements Interceptor 34 { 35 static int interceptions; 36 37 public String getName() 38 { 39 return this.getClass().getName(); 40 } 41 42 public static int getInterceptions() 43 { 44 return interceptions; 45 } 46 47 public static void reset() 48 { 49 interceptions = 0; 50 } 51 52 public Object invoke(Invocation invocation) throws Throwable 53 { 54 try 55 { 56 interceptions++; 57 return invocation.invokeNext(); 58 } 59 catch(Exception e) 60 { 61 throw e; 62 } 63 } 64 65 66 } 67 | Popular Tags |