我有以下课程:
package Test;
public class A
{
private B b = new B()
{
@Override
public boolean someFunc() {return false;}
}
}
什么是AspectJ切入点来捕获someFunc的执行,同时获得对外部类A的引用?
我试过了:
pointcut captureExec(): within(Test.A) && execution(boolean Test.B+.someFunc());
before(): captureExec()
{
//here thisJoinPount.getTarget() returns object to class B,
//but I need reference object to the outer class A
}
由于
答案 0 :(得分:0)
应该是这样的:
pointcut captureExec(Test.A a): within(a) && execution(boolean Test.B+.someFunc());
before(Test.A a): captureExec(a)
{
if(a==blah) ...
}
虽然没有尝试过