Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Intercepting collection event

Hello.

You either have to use a tracematch (available in the AspectBench
Compiler), http://abc.comlab.ox.ac.uk/papers#oopsla2005, or you have
to use two pieces of advice:

Object myObject;

before(Object o): call(* *.getMyList()) && target(o) {
  //store last object called into myObject
  myObject = o;
}

before(): call(* MyClass.get*.add*(..)) {
  //do something with myObject
}

Eric


On 26/03/2008, Fifre <fifre.news@xxxxxxx> wrote:
> Hello,
>
>  In the following code, I want to process on "myObject" everytime a
>  add*() method is called :
>
>  myObject.getMyList().add()
>
>  I'm not able to find the suitable pointcut... I can get the Collection
>  returned by getMyList(), but I can't get the object that contains the
>  List.
>
>  I tried :
>
>  public pointcut AddItem(MyClass r):
>         call(* MyClass.get*.add*(..)) && target(r);
>
>  Any ideas ?
>  Thanks !
>
>  Fifre
>
>  _______________________________________________
>  aspectj-users mailing list
>  aspectj-users@xxxxxxxxxxx
>  https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top