1 8 package test.customproceed; 9 10 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 11 import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint; 12 13 16 public class MyAspect { 17 18 public static interface ProceedWithIntArg extends JoinPoint { 19 Object proceed(int i); 20 } 21 22 public static interface ProceedWithLongArg extends StaticJoinPoint { 23 Object proceed(long l); 24 } 25 26 public static interface ProceedWithStringArg extends JoinPoint { 27 Object proceed(String s); 28 } 29 30 public static interface ProceedWithMiscArgs1 extends StaticJoinPoint { 31 Object proceed(long i, String s); 32 } 33 34 public static interface ProceedWithMiscArgs2 extends StaticJoinPoint { 35 Object proceed(long i, String s, int[][] matrix); 36 } 37 38 41 public Object around1(ProceedWithIntArg jp, int i) { 42 CustomProceedTest.log("around1 "); 43 CustomProceedTest.log(new Integer (i).toString()); 44 CustomProceedTest.log(" "); 45 return jp.proceed(1); 46 } 47 48 49 52 public Object around2(ProceedWithLongArg jp, long l) { 53 CustomProceedTest.log("around2 "); 54 CustomProceedTest.log(new Long (l).toString()); 55 CustomProceedTest.log(" "); 56 return jp.proceed(2); 57 } 58 59 62 public Object around3(ProceedWithStringArg jp, String s) { 63 CustomProceedTest.log("around3 "); 64 CustomProceedTest.log(s); 65 CustomProceedTest.log(" "); 66 return jp.proceed("gnitset"); 67 } 68 69 74 public Object around4(ProceedWithMiscArgs1 jp, long l, String s) { 75 CustomProceedTest.log("around4 "); 76 CustomProceedTest.log(new Long (l).toString()); 77 CustomProceedTest.log(" "); 78 CustomProceedTest.log(s); 79 CustomProceedTest.log(" "); 80 return jp.proceed(12345, "gnitset"); 81 } 82 83 86 public Object around5(ProceedWithMiscArgs2 jp, long l, String s, int[][] matrix) { 87 CustomProceedTest.log("around5 "); 88 CustomProceedTest.log(new Long (l).toString()); 89 CustomProceedTest.log(" "); 90 CustomProceedTest.log(s); 91 CustomProceedTest.log(" "); 92 CustomProceedTest.log(new Integer (matrix[0][0]).toString()); 93 CustomProceedTest.log(" "); 94 matrix[0][0] = 123; 95 return jp.proceed(12345, "gnitset", matrix); 96 } 97 } 98 | Popular Tags |