import org.jboss.aop.joinpoint.Invocation; import org.jboss.aop.Aspect; import org.jboss.aop.Bind; /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ /** * * @author Kabir Khan * @version $Revision: 1.1 $ */ @Aspect public class TestAspect { @Bind (pointcut="execution(POJO->new())") public Object advice(Invocation invocation)throws Throwable { try { System.out.println("<<< Entering TestAspect.advice type:" + invocation); return invocation.invokeNext(); } finally { System.out.println("<<< Leaving TestAspect.advice type:" + invocation); } } @Bind (pointcut="execution(POJO->new())") public Object otherAdvice(Invocation invocation)throws Throwable { try { System.out.println("<<< Entering TestAspect.otherAdvice type:" + invocation); return invocation.invokeNext(); } finally { System.out.println("<<< Leaving TestAspect.otherAdvice type:" + invocation); } } }