1 8 package test.afterxxx; 9 10 import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint; 11 import org.codehaus.aspectwerkz.definition.Pointcut; 12 13 16 public class Aspect { 17 18 21 Pointcut all; 22 23 26 Pointcut aroundFinally; 27 28 31 Pointcut aroundReturning; 32 33 36 Pointcut aroundFinallyReturning; 37 38 41 Pointcut aroundFinallyReturningThrowing; 42 43 46 Pointcut aroundReturningThrowing; 47 48 51 Pointcut _finally; 52 53 56 Pointcut finallyReturning; 57 58 61 Pointcut finallyReturningThrowing; 62 63 66 Pointcut returning; 67 68 71 Pointcut returningThrowing; 72 73 77 public Object logAround(StaticJoinPoint joinPoint) throws Throwable { 78 Test.log("logAround "); 79 final Object result = joinPoint.proceed(); 80 return result; 81 } 82 83 88 public void logAfterReturning(final StaticJoinPoint joinPoint) throws Throwable { 89 Test.log("logAfterReturning "); 90 } 91 92 97 public void logAfterReturningString(final StaticJoinPoint joinPoint) throws Throwable { 98 Test.log("logAfterReturningString "); 99 } 100 101 106 public void logAfterThrowingRTE(final StaticJoinPoint joinPoint) throws Throwable { 107 Test.log("logAfterThrowingRTE "); 108 } 109 110 115 public void logAfterThrowing(final StaticJoinPoint joinPoint) throws Throwable { 116 Test.log("logAfterThrowing "); 117 } 118 119 123 public void logAfterFinally(final StaticJoinPoint joinPoint) throws Throwable { 124 Test.log("logAfterFinally "); 125 } 126 127 130 public void logAfter(final StaticJoinPoint joinPoint) throws Throwable { 131 Test.log("logAfter "); 132 } 133 134 137 public void logAfterBinding(int i) { 138 TestBinding.log("afterReturningInt " + i); 139 } 140 141 144 public void logAfterBinding(String s) { 145 TestBinding.log("afterReturningString " + s); 146 } 147 148 151 public void logAfterBindingExact(ClassNotFoundException e) { 152 TestBinding.log("afterThrowingExact " + e.getClass().getName()); 153 } 154 155 158 public void logAfterBindingParentClass(Exception e) { 159 TestBinding.log(" afterThrowingParentClass " + e.getClass().getName()); 160 } 161 } | Popular Tags |