You can write an advice that receives a MethodCalledByMethodInvocation. This 
way, you can access the caller.

However, this invocation must be used only on advices bound to "call" pointcut 
expressions.

If you use an "execution" pointcut, what you get is MethodInvocation, and you 
will only have access to the called method.

If you use call + withincode on your pointcut expression, you can specify  the 
method called (inside of call), and the caller method (inside of withincode).

Look at this example:

  | call(int java.util.ArrayList->size()) AND withincode(void Driver->caller())
  | 

This pointcut expression matches all calls to ArrayList.size() made by the 
method Driver.caller(). Look at the complete example here:
http://labs.jboss.com/portal/jbossaop/docs/1.5.0.GA/docs/aspect-framework/examples/caller/caller.html

We will allow more flexibility in this area on JBoss AOP 2.0. You will be able 
to receive the caller and the target of the call as arguments to your advice.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3993038#3993038

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3993038
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to