[jboss-user] [JBoss AOP] - Pointcut intercepting methods with annotated arguments

jarr do-not-reply at jboss.com
Sun Mar 22 16:46:08 EDT 2009


Is it possible to write a pointcut to intercept execution of some method which has some of its arguments annotated with certain annotation. For example method declared as follows:

void someMethod(@SomeAnnotation String arg1) {...}

It would be nice if pointcut like this would be possible:

execution(* *->*(@SomeAnnotation *))

or even better:

execution(* *->*(.., @SomeAnnotation *, ..)) - it would mean, that pointcut should match execution of any method with any of its arguments being annotated with @SomeAnnotation.

If such pointcut worked it would be trivial to implement an aspect checking not null conditions on method arguments:
void exampleMethod(String nullable, @NotNull String notNullable) {...}

Regards
Jarek

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4220096#4220096

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4220096



More information about the jboss-user mailing list