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.hierarchicalpattern;
08:
09: import test.Loggable;
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(* test.hierarchicalpattern.DummyInterface1+.declaringType1(..))
21: */
22: Pointcut pc1;
23:
24: /**
25: * @Expression execution(* test.hierarchicalpattern.DummyInterface2+.declaringType2(..))
26: */
27: Pointcut pc2;
28:
29: /**
30: * @Expression execution(test.hierarchicalpattern.DummyInterface2+
31: * test.hierarchicalpattern.HierachicalPatternTest.returnType*(..))
32: */
33: Pointcut pc3;
34:
35: /**
36: * @Expression execution(*
37: * test.hierarchicalpattern.HierachicalPatternTest.parameterTypes(test.hierarchicalpattern.DummyInterface1+,
38: * test.hierarchicalpattern.DummyInterface2+))
39: */
40: Pointcut pc4;
41:
42: /**
43: * @Around pc1 || pc2 || pc3 || pc4
44: */
45: public Object advice(final JoinPoint joinPoint) throws Throwable {
46: ((Loggable) joinPoint.getTarget()).log("before1 ");
47: final Object result = joinPoint.proceed();
48: ((Loggable) joinPoint.getTarget()).log("after1 ");
49: return result;
50: }
51: }
|