Suppose I have a class structure like :
@MyAnnotationOne
class A {
private String id;
private B b;
public static class B {
private C c;
@MyAnnoationOne
public static class C {
@MyAnnotationTwo
private String annotatedString;
}
}
}
I am using annotation processing to generate code. If I'm processing @MyAnnotationOne, then using the Mirror API I can get all the fields in class A and class C.
I want to know if there is any way I could find if any of the fields in class A, going down the hierarchy contain the annotation @MyAnnotationOne or @MyAnnotationTwo. Finding any one would be enough.
I tried looking for a solution but I found some saying that since the annotation processing happens in a pre-compilation stage, the information might not be available. Please let me know if there's any solution that you might know. It'd be a great help.