1 8 package test.optimizations; 9 10 import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint; 11 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 12 import org.codehaus.aspectwerkz.joinpoint.Rtti; 13 import org.codehaus.aspectwerkz.joinpoint.MethodRtti; 14 import org.codehaus.aspectwerkz.definition.Pointcut; 15 16 19 public class OptimizeAspect { 20 21 23 25 public void beforeNothing() { 26 OptimizeTest.log("before"); 27 } 28 30 public Object aroundNothing() { 31 OptimizeTest.log("around"); 32 return null; } 34 35 public void beforeNothing(int i) { 36 OptimizeTest.log("before"+i); 37 } 38 39 public Object aroundNothing(int i) { 40 OptimizeTest.log("around"+i); 41 return null; 42 } 43 44 45 47 49 public void beforeStaticJoinPoint(StaticJoinPoint sjp) { 50 OptimizeTest.log("beforeSJP-" + sjp.getSignature().getName()); 51 } 52 54 public Object aroundStaticJoinPoint(StaticJoinPoint sjp) throws Throwable { 55 OptimizeTest.log("aroundSJP-" + sjp.getSignature().getName()); 56 return sjp.proceed(); 57 } 58 59 public void beforeStaticJoinPoint(StaticJoinPoint sjp, int i) { 60 OptimizeTest.log("beforeSJP"+i); 61 } 62 63 public Object aroundStaticJoinPoint(int i, StaticJoinPoint sjp) throws Throwable { 64 OptimizeTest.log("aroundSJP"+i); 65 return sjp.proceed(); 66 } 67 68 70 71 Pointcut pc_in; 72 73 77 public void beforeJoinPoint(JoinPoint jp) { 78 OptimizeTest.log("beforeJP-" + jp.getSignature().getName() + "-" + jp.getCallee().toString() + "-" + jp.getCaller().toString()); 79 } 80 84 public Object aroundJoinPoint(JoinPoint jp) throws Throwable { 85 OptimizeTest.log("aroundJP-" + jp.getSignature().getName() + "-" + jp.getCallee().toString() + "-" + jp.getCaller().toString()); 86 return jp.proceed(); 87 } 88 89 public void beforeJoinPoint(JoinPoint jp, int i) { 90 OptimizeTest.log("beforeJP"+i); 91 } 92 93 public Object aroundJoinPoint(int i, JoinPoint jp) throws Throwable { 94 OptimizeTest.log("aroundJP"+i); 95 return jp.proceed(); 96 } 97 98 100 104 public void beforeRtti(JoinPoint jp) { 105 OptimizeTest.log("beforeRTTI-" + jp.getRtti().getName() + jp.getRtti().getThis() + jp.getRtti().getTarget()); 106 } 107 108 112 public Object aroundRtti(JoinPoint jp) throws Throwable { 113 OptimizeTest.log("aroundRTTI-" + jp.getRtti().getName() + jp.getRtti().getThis() + jp.getRtti().getTarget()); 114 return jp.proceed(); 115 } 116 117 120 public void beforeRttiInt(JoinPoint jp) { 121 OptimizeTest.log("beforeRTTI-" + jp.getRtti().getName() + jp.getRtti().getThis() + jp.getRtti().getTarget()); 122 Integer param = (Integer ) ((MethodRtti) jp.getRtti()).getParameterValues()[0]; 123 } 125 126 129 public Object aroundRtti(StaticJoinPoint sjp, JoinPoint jp ) throws Throwable { 130 OptimizeTest.log("aroundRTTI-" ); 131 return sjp.proceed(); 132 } 133 } 134 | Popular Tags |