I have built an annotation processor that is triggered with the com.foo.FooEntity annotation. There is a need to be able to create more stereotypes that would trigger that annotation processor as well.
For instance, a controller should also trigger this annotation processor. I am wondering if there is a way to place the @FooEntity annotation on it. Something like:
@FooEntity
@Target(TYPE)
@Retention(RUNTIME)
public @interface Controller {}
And use this so that this class triggers annotation processing
@Controller
public class MyController { ... }
Of course, the idea here is that I want to add new stereotypes without having to touch the annotation processor itself.
I don’t think there is a way to configure a processor to process
@FooEntityas well as annotations meta-annotated with@FooEntity(@Controllerin this case). What you could do instead is have a processor that supports any annotation (@SupportedAnnotationTypes("*")) and then implement some further logic within the processor itself in order to decide which annotations you do want to process. Here is such an implementation based on my understanding of the problem:A sample run would give you: