I think I should show you a simple example code:
|
| public class A{
| @InterceptMe
| public void sayHello(){
| System.out.println("hello");
| }
| }
|
| public class B extends A{
| @InterceptMe
| public void sayHello(){
| super.sayHello();
| System.out.println("foo");
| }
| }
|
| jboss-aop.xml
|
| <aop>
| <bind pointcut="execution(* *->@aop.InterceptMe(..))">
| <interceptor class="aop.TheInterceptor"
scope="PER_VM"/>
| </bind>
| </aop>
|
|
Ok, so basically every method with the InterceptMe Annotation ist intercepted by
TheInterceptor (great name isnt it? ^^).
In this Interceptor every method ist called again with reflection (doesnt make much sense
in this example, but for my project). Now the problem is, that if super.sayHello() is
called, the Invocation class does still give me class B if I call
myInvocation.getTargetObject(). This is a problem when invoking the method with reflection
(method is invoked on the wrong class B instead of class A).
Any idea how I can get the superclass?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250145#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...