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 test.orthogonal;
08:
09: import test.Loggable;
10: import org.codehaus.aspectwerkz.definition.Pointcut;
11: import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
12:
13: /**
14: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
15: * @Aspect perJVM
16: */
17: public class OrthogonalTestAspect {
18: // ============ Pointcuts ============
19:
20: /**
21: * @Expression execution(* test.orthogonal.OrthogonalTest.method*(..))
22: */
23: Pointcut pcMethod;
24:
25: /**
26: * @Expression get(* test.orthogonal.OrthogonalTest.m_getFieldAroundAdviced) && within(test.orthogonal.*)
27: */
28: Pointcut pcGet;
29:
30: /**
31: * @Expression set(* test.orthogonal.OrthogonalTest.m_setFieldAroundAdviced) && within(test.orthogonal.*)
32: */
33: Pointcut pcSet;
34:
35: // ============ Advices ============
36:
37: /**
38: * @Around pcMethod || pcGet || pcSet
39: */
40: public Object advice1(final JoinPoint joinPoint) throws Throwable {
41: ((Loggable) joinPoint.getTarget()).log("before ");
42: Object o = joinPoint.proceed();
43: ((Loggable) joinPoint.getTarget()).log("after ");
44: return o;
45: }
46: }
|