How can I express a point cut that finds methods only when being called from within another method, but not directly?
For example:
Foo() calls Bar() calls object.Method()
also
NotFoo() calls Bar() calls object.Method()
I only want the pointcut to work for within Foo()
I tried "withincode," but that seems to only work directly.
Thanks Eric
What you want actually requires two joinpoints:
call
method or constructor in Bar class and be within
Foo class or eventually Foo() constructor with withincode
designator. The advice to this joinpoint can for example set a flag that to true when called from Foo() and falso otherwise. This variabel can be stored in a HashMap with the thread as key to avoid concurrency issues.withincode
Bar() constructor or within Bar class and call
object.Method(). The advice to this joinpoint must also check if the flag is set to true. And finally set the Foo flag to false again.