[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Caller joinpoint

thisEnclosingJoinPoint?


Nicholas Lesiecki Software Craftsman, specializing in J2EE, Agile Methods, and aspect-oriented programming m: 520 591-1849

Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv
On Dec 7, 2004, at 5:15 PM, André Dantas Rocha wrote:

Hi,
 
Is there a way to capture the caller joinpoint (the joinpoint that contains the caller method)?
There is a small example:
 
public class A {
  void m1() {...}
  void m2() { m1(); }
  void m3() { m2(); };
}
 
public class B {
  void m4() { A.m3(); }
}
 
public aspect TraceCaller {
  pointcut pc(JoinPoint caller) : cflow(call(* *.*(..)) && this(caller)); ????
}
 
expected result:
m1 caller = call(void A.m2())
m2 caller = call(void A.m3())
m3 caller = call(void B.m4())
 
 
Thanks,
 
André