Given this annotation:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Interceptor {
Class<? extends Behaviour> value();
}
The users of my library can extend its API creating custom annotations annotated with @Interceptor
, as follows:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Interceptor(BypassInterceptor.class)
public @interface Bypass {
}
AbstractProcessor provides a method called getSupportedAnnotationTypes which returns the names of the annotation types supported by the processor. But if I specify the name of @Interceptor
, as follows:
@Override public Set<String> getSupportedAnnotationTypes() {
Set<String> annotations = new LinkedHashSet();
annotations.add(Interceptor.class.getCanonicalName());
return annotations;
}
The processor#process method will not be notified when a class is annotated with @Bypass
annotation.
So, when using an AbstractProcessor
, how to claim for annotations which target is another annotation?