aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs154/pr194314/test/ServiceInterceptor.java
blob: 491fa5027b7936d77367ee6eedc36465095700f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package test;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

 @Aspect public class ServiceInterceptor {
//public aspect ServiceInterceptor {
	
//	void around(): execution(void test.Service.method(long)) {
//        Object[] args = thisJoinPoint.getArgs();
//        long id = (Long) args[0];
//        System.out.println("in advice, arg = " + id + " (before proceed)");
//        proceed();
//        System.out.println("in advice (after proceed)");
//    }
	
    @Around("execution(void test.Service.method(long))")
    public void method(ProceedingJoinPoint pjp) throws Throwable {
        Object[] args = pjp.getArgs();
        long id = (Long) args[0];
        System.out.println("in advice, arg = " + id + " (before proceed)");
        pjp.proceed(pjp.getArgs());
        System.out.println("in advice (after proceed)");
    }
}