I'm trying to create a pointcut based on the parameter of an annotaion
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface MyAnnotation {
Class<? extends ABC> style() default A.class;
}
And the pointcut I'm currently using is:
@Pointcut("execution(@com.something.MyAnnotation * *(..))")
public void dummyMethod() {
}
@Around("method()")
public Object actualFunc(ProceedingJoinPoint joinPoint) throws Throwable {
//stuff
}
But that unfortunately activates on all values of style.
Obviously you could check in the advice if the advised method had the annotation value you are looking for, but that is less than ideal (it is a runtime check). In your case you can just use the syntax:
There is a little bit of info here on annotation value matching: https://eclipse.org/aspectj/doc/released/README-160.html