Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] get a object not "this" or "target"

hi, say I have the following classes:
 
public class A {
  B b = new B();
  private void ma() {
    b.mb();
 }
}
public class B {
  C b = new C();
 private void ma() {
   for(something){
     c.mc();
   }
 }
}
 
Now I want to catch the join point of calling to --or executing -- C.mc and  get the object of class A who on the top of the call stack, like this:
 private pointcut p(int thisDone,Object iWantA) :
  call(* C.mc(..)) &&
  cflowbelow(execution(* A.ma()))
  && args(byte[], int, thisDone)
  && this(iWantA);
 
I know this won't work. I can only get b when use this. But how can I get a? Can any one give me some suggestion?

Back to the top