We have two annotations in our project and I’d like to collect the annotated classes and create a merged output based on both lists of classes.
Is this possible with only one Processor instance? How do I know if the Processor instance was called with every annotated class?
The framework calls the
Processor.processmethod only once (per round) and you can access both lists at the same time through the passedRoundEnvironmentparameter. So you can process both lists in the sameprocessmethod call.To do this list both annotations in the
SupportedAnnotationTypesannotation:Here is a sample
processmethod:And its output:
It prints all classes which are annotated with the
MyAnnotationor theMyOtherAnnotationannotation.