1 8 package test.aspect; 9 10 import test.Loggable; 11 import org.codehaus.aspectwerkz.definition.Pointcut; 12 import org.codehaus.aspectwerkz.definition.Pointcut; 13 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 14 15 19 public class CFlowTestAspect { 20 22 25 Pointcut pc1; 26 27 30 Pointcut pc1_A; 31 32 35 Pointcut pc1_B; 36 37 40 Pointcut pc2; 41 42 45 Pointcut pc2_B; 46 47 49 52 public Object execute(final JoinPoint joinPoint) throws Throwable { 53 ((Loggable) joinPoint.getTarget()).log("advice-before "); 54 final Object result = joinPoint.proceed(); 55 ((Loggable) joinPoint.getTarget()).log("advice-after "); 56 return result; 57 } 58 59 62 public Object execute2(final JoinPoint joinPoint) throws Throwable { 63 ((Loggable) joinPoint.getTarget()).log("advice-before2 "); 64 final Object result = joinPoint.proceed(); 65 ((Loggable) joinPoint.getTarget()).log("advice-after2 "); 66 return result; 67 } 68 69 73 public Object executeAnonymous(final JoinPoint joinPoint) throws Throwable { 74 ((Loggable) joinPoint.getTarget()).log("advice-beforeAnonymous "); 75 final Object result = joinPoint.proceed(); 76 ((Loggable) joinPoint.getTarget()).log("advice-afterAnonymous "); 77 return result; 78 } 79 80 86 public Object executeC(final JoinPoint joinPoint) throws Throwable { 87 ((Loggable) joinPoint.getTarget()).log("advice-beforeC "); 88 final Object result = joinPoint.proceed(); 89 ((Loggable) joinPoint.getTarget()).log("advice-afterC "); 90 return result; 91 } 92 93 96 public void afterMySelf(JoinPoint joinPoint) { 97 ((Loggable) joinPoint.getTarget()).log("advice-cflowOnMyself "); 98 } 99 } | Popular Tags |