[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] How do I specify the argument at any location ?

This true, but you can write a useful special case that matches foo in the
first N argument positions like this:

args(foo, ..) || args(!Foo, foo, ..) || args(!Foo, !Foo, foo, ..) ...

where Foo is the type of foo.

To be fully general, you can also write advice on args(!Foo, !Foo, !Foo....,
!Foo, ..) with thisJoinPoint.getArgs() to handle the case where Foo appears
with more than N arguments

See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=160509 which is the
bugzilla tracking entry for an enhancement request for AspectJ that I
submitted to allow specifying an argument of a given type at any location. 

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Eric Bodden
Sent: Monday, October 16, 2006 8:06 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] How do I specify the argument at any location ?

No, AFAIK there's currently no way to do it. All you can do is use
reflection (thisJoinPoint.getArgs()).


Eric


> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-
> bounces@xxxxxxxxxxx] On Behalf Of Ingram Chen
> Sent: Monday, October 16, 2006 9:56 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] How do I specify the argument at any location
> ?
> 
> 
> Hi all,
> @AspectJ support wild card in args such as:
> 
> args(foo, ..) // first argument match foo, the rest is any or args(..,
> foo) // last argument match foo, the rest is any
> 
> but I can't specify foo at any location like:
> 
> args(..,foo, ..) // one argument match foo at any location
> 
> It seems @AspectJ only support one ".." in the expression. Is there
any
> other way to achieve this ? or @AspectJ just not support such feature
?
> 
> Thanks in advance
> 
> --
> View this message in context: http://www.nabble.com/How-do-I-specify-
> the-argument-at-any-location---tf2456595.html#a6847040
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users