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.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.reflection.*2.*(..)) 21 */ 22 Pointcut test1_exclude; 23 24 /*** 25 * @Expression execution(* test.reflection.*.incr(..)) 26 */ 27 Pointcut test1; 28 29 /*** 30 * @Expression execution(* test.reflection.*.incrStatic(..)) 31 */ 32 Pointcut test1Static; 33 34 /*** 35 * @Expression execution(* test.reflection.Super2.incr(..)) 36 */ 37 Pointcut test2; 38 39 /*** 40 * @Expression execution(* test.reflection.Super2.incrStatic(..)) 41 */ 42 Pointcut test2Static; 43 44 /*** 45 * @Expression execution(* test.reflection.*.do*(..)) 46 */ 47 Pointcut test3; 48 49 /*** 50 * @Around test1 && !test1_exclude 51 */ 52 public Object execute1(final JoinPoint jp) throws Throwable { 53 Integer result = (Integer) jp.proceed(); 54 return new Integer(-1 * result.intValue()); 55 } 56 57 /*** 58 * @Around test1Static && !test1_exclude 59 */ 60 public Object execute2(final JoinPoint jp) throws Throwable { 61 Integer result = (Integer) jp.proceed(); 62 return new Integer(-1 * result.intValue()); 63 } 64 65 /*** 66 * @Around test2 67 */ 68 public Object execute3(final JoinPoint jp) throws Throwable { 69 Integer result = (Integer) jp.proceed(); 70 return new Integer(-1 * result.intValue()); 71 } 72 73 /*** 74 * @Around test2Static 75 */ 76 public Object execute4(final JoinPoint jp) throws Throwable { 77 Integer result = (Integer) jp.proceed(); 78 return new Integer(-1 * result.intValue()); 79 } 80 81 /*** 82 * @Around test3 83 */ 84 public Object execute5(final JoinPoint jp) throws Throwable { 85 Integer result = (Integer) jp.proceed(); 86 return new Integer(-1 * result.intValue()); 87 } 88 }