Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Pointcut for "where any parameters are annotated by"?

Hi Matthew,

This is discussed in here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=233718

but there are still issues around agreeing a syntax (and a reasonable
implementation).

At the moment the best you can do is what you have, support annotation
of argument 'n' by having variants for each.

Maybe add your proposed syntax to that bugzilla as a suggestion, I
don't think we have something like that.

cheers,
Andy

On 12 February 2012 09:03, Matthew Adams <matthew@xxxxxxxxxxxxxxx> wrote:
> Hi all,
>
> Just wondering if there's a way to express a pointcut meaning "any method
> with any parameters annotated with @javax.validation.constraint.*".
>
> For example, these would match:
> public void m1(@Foo in x, int y) ...
> public void m2(int x, @Foo int y) ...
> public void m3(@Foo int x, @Foo int y, int z) ...
>
> These would not:
> public void m1(int x) ...
> public void @Foo m2(int x) ...
> public void m3(int x, int y, int z) ...
>
> The best I've come up with is support for a fixed set of pointcuts of size n
> that supports the first n arguments:
>
>    pointcut validatedMethodCall() :
>        execution(* *(@(javax.validation.constraints.*) (*), ..))
>        || execution(* *(*, @(javax.validation.constraints.*) (*), ..))
>        || execution(* *(*, *, @(javax.validation.constraints.*) (*), ..))
>        || execution(* *(*, *, *, @(javax.validation.constraints.*) (*),
> ..))
>        || execution(* *(*, *, *, *, @(javax.validation.constraints.*) (*),
> ..))
>        || execution(* *(*, *, *, *, *, @(javax.validation.constraints.*)
> (*), ..))
>        || execution(* *(*, *, *, *, *, *, @(javax.validation.constraints.*)
> (*), ..))
>        || execution(* *(*, *, *, *, *, *, *,
> @(javax.validation.constraints.*) (*), ..));
>
> I'd prefer a more general syntax.  Something like the following would be
> nice:
>
>    pointcut validatedMethodCall() :
>        execution(* *(@(javax.validation.constraints.*) (..)))
>
> Thanks,
> Matthew
>
>
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/Pointcut-for-where-any-parameters-are-annotated-by-tp4381499p4381499.html
> 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


Back to the top