Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] method parameter(s) annotation pointcut question

Hi Adrian,

I'm afraid you can't do that at the moment.  The enhancement
https://bugs.eclipse.org/bugs/show_bug.cgi?id=233718 is in a closely
related area concerning subsetting the matched arguments that have a
particular annotation.  Unfortunately there are a few reasons it
hasn't progressed, discussed in the bug, but I'd say primarily the
reason is the amount of effort required to implement it when there is
a trivial workaround.  It isn't pretty but if you just write a few
more pointcuts you can capture all the cases you are interested in:

before(): execution(* *(@Foo (*),..)) { // 1st param
before(): execution(* *(*,@Foo (*),..)) { // 2nd param
before(): execution(* *(*,*,@Foo (*),..)) { // 3rd param
before(): execution(* *(*,*,*,@Foo (*),..)) { // 4th param
etc...

Andy

On 26 June 2010 01:17, Adrian Citu <citu_adrian@xxxxxxxxx> wrote:
> Hello AspectJ users,
>
> I would like to know if it's possible to have a pointcut that will capture the execution of all the methods which have AT LEAST one parameter annotated with a specific annotation.
>
> The following pointcut "execution( * * *(@Foo(*)))" will capture the methods having ONLY one parameter and "execution( * * *(@Foo(..)))" is not a valid pointcut.
>
> Basically I would like to capture the following kind of method signatures:
>
> ....method(@Foo Object param)//captured by execution( * * *(@Foo(*)))
> ....method(@Foo Object param, Object param2)
> ....method(@Foo Object param, @Foo Object param2)
>
> Thanks,
>
> Adrian
> http://aoplib4j.org
>
>
>
>
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top