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 test.pointcutexpression;
9
10 import org.codehaus.aspectwerkz.definition.Pointcut;
11 import org.codehaus.aspectwerkz.definition.Pointcut;
12 import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
13
14 /***
15 * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
16 * @Aspect
17 */
18 public class TestAspect {
19 /***
20 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.A())
21 */
22 Pointcut A;
23
24 /***
25 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.B())
26 */
27 Pointcut B;
28
29 /***
30 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.C())
31 */
32 Pointcut C;
33
34 /***
35 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.D())
36 */
37 Pointcut D;
38
39 /***
40 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.E())
41 */
42 Pointcut E;
43
44 /***
45 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.F())
46 */
47 Pointcut F;
48
49 /***
50 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.G())
51 */
52 Pointcut G;
53
54 /***
55 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.H())
56 */
57 Pointcut H;
58
59 /***
60 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.I())
61 */
62 Pointcut I;
63
64 /***
65 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.J())
66 */
67 Pointcut J;
68
69 /***
70 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.K())
71 */
72 Pointcut K;
73
74 /***
75 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.L())
76 */
77 Pointcut L;
78
79 /***
80 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.M())
81 */
82 Pointcut M;
83
84 /***
85 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.N())
86 */
87 Pointcut N;
88
89 /***
90 * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.O())
91 */
92 Pointcut O;
93
94 /***
95 * @Around B || C
96 */
97 public Object advice1(final JoinPoint joinPoint) throws Throwable {
98 PointcutExpressionTest.log("before1 ");
99 final Object result = joinPoint.proceed();
100 PointcutExpressionTest.log("after1 ");
101 return result;
102 }
103
104 /***
105 * @Around D && !E
106 */
107 public Object advice2(final JoinPoint joinPoint) throws Throwable {
108 PointcutExpressionTest.log("before1 ");
109 final Object result = joinPoint.proceed();
110 PointcutExpressionTest.log("after1 ");
111 return result;
112 }
113
114 /***
115 * @Around (F || G) && H
116 */
117 public Object advice3(final JoinPoint joinPoint) throws Throwable {
118 PointcutExpressionTest.log("before1 ");
119 final Object result = joinPoint.proceed();
120 PointcutExpressionTest.log("after1 ");
121 return result;
122 }
123
124 /***
125 * @Around (I || J)
126 */
127 public Object advice4(final JoinPoint joinPoint) throws Throwable {
128 PointcutExpressionTest.log("before1 ");
129 final Object result = joinPoint.proceed();
130 PointcutExpressionTest.log("after1 ");
131 return result;
132 }
133
134 /***
135 * @Around !K && !(L || M) && N
136 */
137 public Object advice5(final JoinPoint joinPoint) throws Throwable {
138 PointcutExpressionTest.log("before1 ");
139 final Object result = joinPoint.proceed();
140 PointcutExpressionTest.log("after1 ");
141 return result;
142 }
143
144 /***
145 * @Around O
146 */
147 public Object advice6(final JoinPoint joinPoint) throws Throwable {
148 PointcutExpressionTest.log("before1 ");
149 final Object result = joinPoint.proceed();
150 PointcutExpressionTest.log("after1 ");
151 return result;
152 }
153 }