如何解决AopAllianceGuice:从拦截的方法中调用另一个方法
|| 在使用AopAlliance进行方法拦截中,有没有一种方法可以从类中调用谁被拦截的方法? 例如:public class MyClass {
public void interceptMe() {}
public void invokeMe() {}
}
和
public class MyInterceptor implements MethodInterceptor {
public Object invoke(MethodInvocation invocation) throws Throwable {
// This is where MyClass.interceptMe() is intercepted
// I would like to call MyClass.invokeMe() for the instance of the class who\'s method was intercepted
}
}
如果需要,我将乐意提供更多详细信息。
解决方法
怎么样
((MyClass)invocation.getThis()).invokeMe()
http://aopalliance.sourceforge.net/doc/org/aopalliance/intercept/MethodInvocation.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。