【发布时间】:2014-04-15 20:23:54
【问题描述】:
我有一个一般性的 AOP 问题,请在这种情况下澄清一下, 假设我们有一个捕获方法执行的执行切入点: 在我们的方面,我们有一个:
pointcut pointcut_CatchMethod(Activity activity) : execution(String methodA(..))
&& target(activity);
这里,我们在目标活动中有一个methodA()。 我们在前后有 2 条建议。喜欢:
before(Activity activity) : pointcut_CatchMethod(activity){
//Do something...
}
String around(Activity activity) : pointcut_CatchMethod(activity){
//Do something different.
}
所以我的问题是,我们能否在这些 before 和 around 建议之间调用像 aMethodIntheAspect() 之类的方法(此方法在方面)。我无法做到这一点,因为我认为之前和周围的建议以某种方式同时执行。
在 Resume 中,如何更改切面中的全局变量的值? (通过 aMethodIntheAspect() )
详细的代码信息请参考此链接: BroadcastReceiver doesn't receive the broadcasted intent in the right time(Receiver's onReceive is being late to be called)
【问题讨论】:
-
无意冒犯,但我阅读了您的几个问题,并希望建议您更多地考虑应用程序和方面设计。从头脑中的问题开始,并专注于寻找合适的解决方案,而不是专注于假设的技术解决方案并使其适合您的问题。其次,请尝试更好地解释您的意图,也许通过提供更明确的代码示例和更少的不清楚的解释。
标签: android broadcastreceiver aop aspectj