AopAlliance(Guice):从截获的方法中调用另一种方法

时间:2011-05-24 04:49:16

标签: java aop guice aopalliance

在使用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
     }
}

如果需要,我很乐意提供更多详细信息。

1 个答案:

答案 0 :(得分:2)