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...
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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...