Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Question on args()

And is there any difference on performance (using LTW)? I've read that constructing thisJoinPoint is an expensive operation. Would using args() avoid this?

regards,

Wim

2006/9/8, Adrian Colyer < adrian.colyer@xxxxxxxxx>:
Yes, both examples will do the same thing here. 

On 8 Sep 2006, at 15:24, Wim Deblauwe wrote:

Hi,

reading through http://www.eclipse.org/aspectj/doc/released/progguide/language-joinPoints.html#pointcut-parameters , I can understand the difference between target() and args() pointcuts. Is it correct to say that in stead of using this:

pointcut setter(Point p, int newval): target(p) &&
                                      args(newval) &&
                                      (call(void setX(int)) ||
                                       call(void setY(int)));

I use this:

pointcut setter(Point p): target(p) &&
                                      (call(void setX(int)) ||
                                       call(void setY(int)));

and then I can also get the 'newval' by using (in the corresponding advice):

int newval = (Integer)thisJoinPoint.getArgs()[0];

I know this is not so nice, but I just want to know if they are the same. Because now I'm always using the getArgs() method, but it would be better to use the args() pointcut then (if my assumpions are right)

regards,

Wim
_______________________________________________
aspectj-users mailing list



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




Back to the top