--- /dev/null
+package test;\r
+\r
+public class Service implements IService {\r
+\r
+ public void method(long l) throws Exception {\r
+ System.err.println("Original impl of service method, arg " + l);\r
+ }\r
+}\r
--- /dev/null
+package test;\r
+\r
+import org.aspectj.lang.ProceedingJoinPoint;\r
+import org.aspectj.lang.annotation.Around;\r
+import org.aspectj.lang.annotation.Aspect;\r
+\r
+ @Aspect public class ServiceInterceptor {\r
+//public aspect ServiceInterceptor {\r
+ \r
+// void around(): execution(void test.Service.method(long)) {\r
+// Object[] args = thisJoinPoint.getArgs();\r
+// long id = (Long) args[0];\r
+// System.out.println("in advice, arg = " + id + " (before proceed)");\r
+// proceed();\r
+// System.out.println("in advice (after proceed)");\r
+// }\r
+ \r
+ @Around("execution(void test.Service.method(long))")\r
+ public void method(ProceedingJoinPoint pjp) throws Throwable {\r
+ Object[] args = pjp.getArgs();\r
+ long id = (Long) args[0];\r
+ System.out.println("in advice, arg = " + id + " (before proceed)");\r
+ pjp.proceed(pjp.getArgs());\r
+ System.out.println("in advice (after proceed)");\r
+ }\r
+}\r