I am trying to generate code by reading annotated method like
@MyAnnotation
public static int generatorMethod(@SomeOtherAnnotation Boolean someArg)
I would like to copy the list of arguments as they are in the generated code
As shown below:
public class MyGeneratedClass{
public int myGeneratedMethod(@SomeOtherAnnotation Boolean someArg) {
//method body
}
}
But when I try to read annotated methods from annotationProcessor class
for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(MyAnnotation.class)) {
messager.printMessage(
Diagnostic.Kind.NOTE, String.format("Annotated Element as string: %s",
annotatedElement.toString()));
}
It prints the value as
Annotated Element as string: generatorMethod(java.lang.Boolean)
Which has no reference to argument's annotation which I could use to create ParameterSpec.
Is there a way to read argument's annotation?