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.staticfield;
08:
09: import org.codehaus.aspectwerkz.definition.Pointcut;
10: import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
11:
12: /**
13: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
14: * @Aspect
15: */
16: public class TestAspect {
17: /**
18: * @Expression set(* test.staticfield.StaticFieldAdviceTest.s_field*)
19: */
20: Pointcut pcSet;
21:
22: /**
23: * @Expression set(* test.staticfield.StaticFieldAdviceTest.m_field*)
24: */
25: Pointcut pcSetMember;
26:
27: /**
28: * @Expression set(* test.staticfield.CollectionFieldTest.s_field)
29: */
30: Pointcut pcSetColl;
31:
32: /**
33: * @Expression set(* test.staticfield.CollectionFieldTest.m_field)
34: */
35: Pointcut pcSetMemberColl;
36:
37: /**
38: * @Expression get(* test.staticfield.CollectionFieldTest.s_field)
39: */
40: Pointcut pcGetColl;
41:
42: /**
43: * @Expression get(* test.staticfield.CollectionFieldTest.m_field)
44: */
45: Pointcut pcGetMemberColl;
46:
47: /**
48: * @Expression within(test.staticfield.*)
49: */
50: Pointcut filter;
51:
52: /**
53: * @Before pcSet && filter
54: */
55: public void preStaticField(final JoinPoint joinPoint)
56: throws Throwable {
57: CollectionFieldTest.s_log += "MyPreAdvice1 ";
58: }
59:
60: /**
61: * @Before pcSetMember && filter
62: */
63: public void preMemberField1(final JoinPoint joinPoint)
64: throws Throwable {
65: CollectionFieldTest.s_log += "MyPreAdvice2 ";
66: }
67:
68: /**
69: * @Before pcSetColl && filter
70: */
71: public void preStaticField2(final JoinPoint joinPoint)
72: throws Throwable {
73: CollectionFieldTest.s_log += "MyPreAdvice1 ";
74: }
75:
76: /**
77: * @Before pcSetMemberColl && filter
78: */
79: public void preMemberField2(final JoinPoint joinPoint)
80: throws Throwable {
81: CollectionFieldTest.s_log += "MyPreAdvice2 ";
82: }
83:
84: /**
85: * @After pcGetColl && filter
86: */
87: public void postStaticField(final JoinPoint joinPoint)
88: throws Throwable {
89: CollectionFieldTest.s_log += "MyPostAdvice1 ";
90: }
91:
92: /**
93: * @After pcGetMemberColl && filter
94: */
95: public void postMemberField(final JoinPoint joinPoint)
96: throws Throwable {
97: CollectionFieldTest.s_log += "MyPostAdvice2 ";
98: }
99: }
|