KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > cflow > CFlowAspect


1 /**************************************************************************************
2  * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
3  * http://aspectwerkz.codehaus.org *
4  * ---------------------------------------------------------------------------------- *
5  * The software in this package is published under the terms of the LGPL license *
6  * a copy of which has been included with this distribution in the license.txt file. *
7  **************************************************************************************/

8 package examples.cflow;
9
10 import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
11 import org.codehaus.aspectwerkz.definition.Pointcut;
12 import org.codehaus.aspectwerkz.definition.Pointcut;
13
14 /**
15  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
16  */

17 public class CFlowAspect {
18
19     /**
20      * @Expression cflow(within(examples.cflow.*) AND call(void examples.cflow.Target.step1()))
21      */

22     Pointcut cflowPointcut;
23
24     /**
25      * @Expression execution(void examples.cflow.Target.step2())
26      */

27     Pointcut methodsToLog;
28
29     /**
30      * @Around methodsToLog AND cflowPointcut
31      */

32     public Object JavaDoc logMethod(final JoinPoint joinPoint) throws Throwable JavaDoc {
33         Object JavaDoc result = joinPoint.proceed();
34         System.out.println(" --> ADVICE : invoking advice triggered by step2");
35         return result;
36     }
37 }
Popular Tags