01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package examples.cflow;
08:
09: import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
10: import org.codehaus.aspectwerkz.definition.Pointcut;
11: import org.codehaus.aspectwerkz.definition.Pointcut;
12:
13: /**
14: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
15: */
16: public class CFlowAspect {
17:
18: /**
19: * @Expression cflow(within(examples.cflow.*) AND call(void examples.cflow.Target.step1()))
20: */
21: Pointcut cflowPointcut;
22:
23: /**
24: * @Expression execution(void examples.cflow.Target.step2())
25: */
26: Pointcut methodsToLog;
27:
28: /**
29: * @Around methodsToLog AND cflowPointcut
30: */
31: public Object logMethod(final JoinPoint joinPoint) throws Throwable {
32: Object result = joinPoint.proceed();
33: System.out
34: .println(" --> ADVICE : invoking advice triggered by step2");
35: return result;
36: }
37: }
|