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.afterxxx; 9 10 import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint; 11 import org.codehaus.aspectwerkz.Pointcut; 12 13 /*** 14 * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a> 15 */ 16 public class Aspect { 17 18 /*** 19 * @Expression execution(* test.afterxxx.Test.all(..)) 20 */ 21 Pointcut all; 22 23 /*** 24 * @Expression execution(* test.afterxxx.Test.aroundFinally(..)) 25 */ 26 Pointcut aroundFinally; 27 28 /*** 29 * @Expression execution(* test.afterxxx.Test.aroundReturning(..)) 30 */ 31 Pointcut aroundReturning; 32 33 /*** 34 * @Expression execution(* test.afterxxx.Test.aroundFinallyReturning(..)) 35 */ 36 Pointcut aroundFinallyReturning; 37 38 /*** 39 * @Expression execution(* test.afterxxx.Test.aroundFinallyReturningThrowing(..)) 40 */ 41 Pointcut aroundFinallyReturningThrowing; 42 43 /*** 44 * @Expression execution(* test.afterxxx.Test.aroundReturningThrowing(..)) 45 */ 46 Pointcut aroundReturningThrowing; 47 48 /*** 49 * @Expression execution(* test.afterxxx.Test._finally(..)) 50 */ 51 Pointcut _finally; 52 53 /*** 54 * @Expression execution(* test.afterxxx.Test.finallyReturning(..)) 55 */ 56 Pointcut finallyReturning; 57 58 /*** 59 * @Expression execution(* test.afterxxx.Test.finallyReturningThrowing(..)) 60 */ 61 Pointcut finallyReturningThrowing; 62 63 /*** 64 * @Expression execution(* test.afterxxx.Test.returning(..)) 65 */ 66 Pointcut returning; 67 68 /*** 69 * @Expression execution(* test.afterxxx.Test.returningThrowing(..)) 70 */ 71 Pointcut returningThrowing; 72 73 /*** 74 * @Around all || aroundFinally || aroundFinallyReturning || 75 * aroundFinallyReturningThrowing || aroundReturningThrowing || aroundReturning 76 */ 77 public Object logAround(StaticJoinPoint joinPoint) throws Throwable { 78 Test.log("logAround "); 79 final Object result = joinPoint.proceed(); 80 return result; 81 } 82 83 /*** 84 * @After returning(java.lang.String) aroundFinallyReturning || aroundFinallyReturningThrowing || 85 * aroundReturningThrowing || finallyReturning || finallyReturningThrowing || 86 * returningThrowing || aroundReturning || returning 87 */ 88 public void logAfterReturning(final StaticJoinPoint joinPoint) throws Throwable { 89 Test.log("logAfterReturning "); 90 } 91 92 /*** 93 * @After throwing(java.lang.RuntimeException) aroundFinallyReturningThrowing || aroundReturningThrowing || 94 * finallyReturningThrowing || returningThrowing 95 */ 96 public void logAfterThrowing(final StaticJoinPoint joinPoint) throws Throwable { 97 Test.log("logAfterThrowing "); 98 } 99 100 /*** 101 * @After finally aroundFinally || aroundFinallyReturning || aroundFinallyReturningThrowing || 102 * _finally || finallyReturning || finallyReturningThrowing 103 */ 104 public void logAfterFinally(final StaticJoinPoint joinPoint) throws Throwable { 105 Test.log("logAfterFinally "); 106 } 107 }