Question

I have a general AOP question, please clarify me on this situation, let's assume we have an execution pointcut that catches a method execution : In our aspect we have a :

pointcut pointcut_CatchMethod(Activity activity) :  execution(String methodA(..))
     && target(activity);

Here, we have a methodA() in target activity. and we have 2 advices before and around. Like :

    before(Activity activity) : pointcut_CatchMethod(activity){
//Do something...
}

    String around(Activity activity) : pointcut_CatchMethod(activity){
//Do something different.
}

So my question is, could we call a method like aMethodIntheAspect() (this method is in the aspect) between these before and around advices. I'm not capable of doing it because I think before and around advices execute in the same time in some manner.

In Resume, How can I change the value of a global variable in the aspect.? (by aMethodIntheAspect() )

For detailed code information please refer to this link: BroadcastReceiver doesn't receive the broadcasted intent in the right time(Receiver's onReceive is being late to be called)

Était-ce utile?

La solution

Solution found, It's not possible to make operation like mentioned in the question, So instead of doing this kind of process, I cancel the original call to methodA() with around aspect, then calling it manually inside a method inside the Aspect.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top