Skip to main content

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

You can do:
pointcut(A a, B b, C c):cflowbelow(execution(A.ma())&&this(a))&&call(c.mc())&&this(b)&&target(c);

Your original pointcut can't get b.


----- Original Message ----
From: Heping Zhang <phoenix.zhp@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Sent: Friday, February 29, 2008 9:08:43 PM
Subject: [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?


-----Inline Attachment Follows-----

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top