문제

I have this piece of code:

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.CodeSignature;

aspect SomeAspect {
    void around(): call(void jy.run()) {
        System.out.println(>> here I want access jy's final field a<<);
    }
}

How to access local field of class jy in aspect's code?

도움이 되었습니까?

해결책

By using the target pointcut:

void around(jy t): target(t) && call(void run()) {
    System.out.println(t.someField);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top