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.staticfield;
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 set(* test.staticfield.StaticFieldAdviceTest.s_field*)
20       */
21      Pointcut pcSet;
22  
23      /***
24       * @Expression set(* test.staticfield.StaticFieldAdviceTest.m_field*)
25       */
26      Pointcut pcSetMember;
27  
28      /***
29       * @Expression set(* test.staticfield.CollectionFieldTest.s_field)
30       */
31      Pointcut pcSetColl;
32  
33      /***
34       * @Expression set(* test.staticfield.CollectionFieldTest.m_field)
35       */
36      Pointcut pcSetMemberColl;
37  
38      /***
39       * @Expression get(* test.staticfield.CollectionFieldTest.s_field)
40       */
41      Pointcut pcGetColl;
42  
43      /***
44       * @Expression get(* test.staticfield.CollectionFieldTest.m_field)
45       */
46      Pointcut pcGetMemberColl;
47  
48      /***
49       * @Before pcSet
50       */
51      public void preStaticField(final JoinPoint joinPoint) throws Throwable {
52          CollectionFieldTest.s_log += "MyPreAdvice1 ";
53      }
54  
55      /***
56       * @Before pcSetMember
57       */
58      public void preMemberField1(final JoinPoint joinPoint) throws Throwable {
59          CollectionFieldTest.s_log += "MyPreAdvice2 ";
60      }
61  
62      /***
63       * @Before pcSetColl
64       */
65      public void preStaticField2(final JoinPoint joinPoint) throws Throwable {
66          CollectionFieldTest.s_log += "MyPreAdvice1 ";
67      }
68  
69      /***
70       * @Before pcSetMemberColl
71       */
72      public void preMemberField2(final JoinPoint joinPoint) throws Throwable {
73          CollectionFieldTest.s_log += "MyPreAdvice2 ";
74      }
75  
76      /***
77       * @After pcGetColl
78       */
79      public void postStaticField(final JoinPoint joinPoint) throws Throwable {
80          CollectionFieldTest.s_log += "MyPostAdvice1 ";
81      }
82  
83      /***
84       * @After pcGetMemberColl
85       */
86      public void postMemberField(final JoinPoint joinPoint) throws Throwable {
87          CollectionFieldTest.s_log += "MyPostAdvice2 ";
88      }
89  }