[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: Re: [aspectj-users] Pointcut refering an Advice

Thanks a lot.


Date: Fri, 16 Jun 2006 09:50:50 +0200
From: "Raymon Van Wanrooij" < rjlwanro@xxxxxxxxx>
Subject: Re: [aspectj-users] Pointcut refering an Advice
To: aspectj-users@xxxxxxxxxxx
       <a4a6a11e0606160050u395bd4fblae8c25999665d7cc@xxxxxxxxxxxxxx >
Content-Type: text/plain; charset="iso-8859-1"

What exactly do you mean with this?
Something like the following example?

public aspect AspectOne {
   pointcut toString(): call(String toString());

   String around(): toString() {
       return toNewString();

   public String toNewString() {
       return "AspectOne";

public aspect AspectTwo {
   pointcut toNewString(): call(String toNewString());

   String around(): toNewString() {
       return "AspectTwo";


When applying these two aspects on a class that somewhere calls a
toString(); method, the following happens.
First, AspectOne is applied, and the toNewString() call is inserted. This
call is matched by the toNewString() pointcut from AspectTwo, thus AspectTwo
is applied.

The result is then, as you might imagine AspectTwo.
Would that be what you mean?


Raymon van Wanrooij

Diego Torres
LIFIA - Laboratorio de Investigación y Formación en Informática Avanzada
Facultad de Informática - Universidad Nacional de La Plata
Calles 50 y 115 La Plata - 1900 Argentina
Phone: +54 221 4228252 Ext: 220
e-mail: diego.torres@xxxxxxxxxxxxxxxxxxxxxx