[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Pointcut for "where any parameters are annotated by"?
|
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.