JBoss.org Community Documentation
Next we want to create an interceptor to the class.
HelloAOPInterceptor
org.jboss.aop.advice.Interceptor
to the list of interceptors.
Then modify the class so it looks like:
import org.jboss.aop.advice.Interceptor; import org.jboss.aop.joinpoint.Invocation; public class HelloAOPInterceptor implements Interceptor { public String getName() { return "HelloAOPInterceptor"; } //We renamed the arg0 parameter to invocation public Object invoke(Invocation invocation) throws Throwable { System.out.print("Hello, "); //Here we invoke the next in the chain return invocation.invokeNext(); } }