001: /**************************************************************************************
002: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
003: * http://aspectwerkz.codehaus.org *
004: * ---------------------------------------------------------------------------------- *
005: * The software in this package is published under the terms of the LGPL license *
006: * a copy of which has been included with this distribution in the license.txt file. *
007: **************************************************************************************/package test.pointcutexpression;
008:
009: import org.codehaus.aspectwerkz.definition.Pointcut;
010: import org.codehaus.aspectwerkz.definition.Pointcut;
011: import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
012:
013: /**
014: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
015: * @Aspect
016: */
017: public class TestAspect {
018: /**
019: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.A())
020: */
021: Pointcut A;
022:
023: /**
024: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.B())
025: */
026: Pointcut B;
027:
028: /**
029: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.C())
030: */
031: Pointcut C;
032:
033: /**
034: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.D())
035: */
036: Pointcut D;
037:
038: /**
039: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.E())
040: */
041: Pointcut E;
042:
043: /**
044: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.F())
045: */
046: Pointcut F;
047:
048: /**
049: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.G())
050: */
051: Pointcut G;
052:
053: /**
054: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.H())
055: */
056: Pointcut H;
057:
058: /**
059: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.I())
060: */
061: Pointcut I;
062:
063: /**
064: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.J())
065: */
066: Pointcut J;
067:
068: /**
069: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.K())
070: */
071: Pointcut K;
072:
073: /**
074: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.L())
075: */
076: Pointcut L;
077:
078: /**
079: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.M())
080: */
081: Pointcut M;
082:
083: /**
084: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.N())
085: */
086: Pointcut N;
087:
088: /**
089: * @Expression execution(void test.pointcutexpression.PointcutExpressionTest.O())
090: */
091: Pointcut O;
092:
093: /**
094: * @Around B || C
095: */
096: public Object advice1(final JoinPoint joinPoint) throws Throwable {
097: PointcutExpressionTest.log("before1 ");
098: final Object result = joinPoint.proceed();
099: PointcutExpressionTest.log("after1 ");
100: return result;
101: }
102:
103: /**
104: * @Around D && !E
105: */
106: public Object advice2(final JoinPoint joinPoint) throws Throwable {
107: PointcutExpressionTest.log("before1 ");
108: final Object result = joinPoint.proceed();
109: PointcutExpressionTest.log("after1 ");
110: return result;
111: }
112:
113: /**
114: * @Around (F || G) && H
115: */
116: public Object advice3(final JoinPoint joinPoint) throws Throwable {
117: PointcutExpressionTest.log("before1 ");
118: final Object result = joinPoint.proceed();
119: PointcutExpressionTest.log("after1 ");
120: return result;
121: }
122:
123: /**
124: * @Around (I || J)
125: */
126: public Object advice4(final JoinPoint joinPoint) throws Throwable {
127: PointcutExpressionTest.log("before1 ");
128: final Object result = joinPoint.proceed();
129: PointcutExpressionTest.log("after1 ");
130: return result;
131: }
132:
133: /**
134: * @Around !K && !(L || M) && N
135: */
136: public Object advice5(final JoinPoint joinPoint) throws Throwable {
137: PointcutExpressionTest.log("before1 ");
138: final Object result = joinPoint.proceed();
139: PointcutExpressionTest.log("after1 ");
140: return result;
141: }
142:
143: /**
144: * @Around O
145: */
146: public Object advice6(final JoinPoint joinPoint) throws Throwable {
147: PointcutExpressionTest.log("before1 ");
148: final Object result = joinPoint.proceed();
149: PointcutExpressionTest.log("after1 ");
150: return result;
151: }
152: }
|