[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Pointcut doubt
|
On Thu, 20 May 2010, Exposito Aguilera, Francisco wrote:
How can I create a pointcut in order to add a log in all methods but getters
or setters?
I have tried execution(* !get*(..)), but it doesn't work.
This works as expected to me:
public aspect AC {
pointcut noget(): execution(* *(..)) && !execution(* get*(..)) ;
after(): noget() {
System.out.println("***AC*** "+thisJoinPoint);
}
}
public class C {
private int x;
public C(int v) {x=v;}
public void dummy() {System.out.println("I'm dummy, x value is "+getx());}
public int getx() {return x;}
public static void main(String argv[]) {
C c = new C(7);
c.dummy();
c.getx();
}
}
>java C
I'm dummy, x value is 7
***AC*** execution(void C.dummy())
***AC*** execution(void C.main(String[]))
I hope this helps.
Walter
--
Walter Cazzola, PhD - Assistant Professor, DICo, University of Milano
E-mail cazzola@xxxxxxxxxxxxx Ph.: +39 02 503 16300 Fax: +39 02 503 16253
· · · ---------------------------- · · · ---------------------------- · · ·
... recursive: adjective, see recursive ...
· · · ---------------------------- · · · ---------------------------- · · ·