Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to match methods which do not have a specific Annotation in AspectJ

I have a custom Annotation called @Invisible. Now I want to match all calls an a method which DOESN'T HAVE an @Invisible Annotation. How can i do this? (with annotation style development)

My first try was:

@Pointcut("execution([email protected] * some.other.package.execute(..))")

but this doesn't seem to work...

In other words: if the method has the Invisible annotation I want to ignore it. Otherwise i want to execute some code with my advice...

like image 627
Moonlit Avatar asked May 30 '12 10:05

Moonlit


1 Answers

try something like execution(* some.other.package.execute(..)) && !@annotation(my.package.Invisible)

like image 139
Konstantin V. Salikhov Avatar answered Sep 30 '22 06:09

Konstantin V. Salikhov