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.reflection;
9
10 import org.codehaus.aspectwerkz.Pointcut;
11 import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
12
13 /***
14 * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
15 * @Aspect
16 */
17 public class TestAspect {
18 /***
19 * @Expression execution(* test.reflection.*2.*(..))
20 */
21 Pointcut test1_exclude;
22
23 /***
24 * @Expression execution(* test.reflection.*.incr(..))
25 */
26 Pointcut test1;
27
28 /***
29 * @Expression execution(* test.reflection.*.incrStatic(..))
30 */
31 Pointcut test1Static;
32
33 /***
34 * @Expression execution(* test.reflection.Super2.incr(..))
35 */
36 Pointcut test2;
37
38 /***
39 * @Expression execution(* test.reflection.Super2.incrStatic(..))
40 */
41 Pointcut test2Static;
42
43 /***
44 * @Expression execution(* test.reflection.*.do*(..))
45 */
46 Pointcut test3;
47
48 /***
49 * @Around test1 && !test1_exclude
50 */
51 public Object execute1(final JoinPoint jp) throws Throwable {
52 Integer result = (Integer) jp.proceed();
53 return new Integer(-1 * result.intValue());
54 }
55
56 /***
57 * @Around test1Static && !test1_exclude
58 */
59 public Object execute2(final JoinPoint jp) throws Throwable {
60 Integer result = (Integer) jp.proceed();
61 return new Integer(-1 * result.intValue());
62 }
63
64 /***
65 * @Around test2
66 */
67 public Object execute3(final JoinPoint jp) throws Throwable {
68 Integer result = (Integer) jp.proceed();
69 return new Integer(-1 * result.intValue());
70 }
71
72 /***
73 * @Around test2Static
74 */
75 public Object execute4(final JoinPoint jp) throws Throwable {
76 Integer result = (Integer) jp.proceed();
77 return new Integer(-1 * result.intValue());
78 }
79
80 /***
81 * @Around test3
82 */
83 public Object execute5(final JoinPoint jp) throws Throwable {
84 Integer result = (Integer) jp.proceed();
85 return new Integer(-1 * result.intValue());
86 }
87 }