I have a bean with annotated getters and fields:
public class CaseSimpleObjGetter {
private int a;
@Hashed
private int b;
private int c;
CaseSimpleObjGetter(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
@Hashed
public int getA() {
return a;
}
protected int getB() {
return b;
}
protected int getC() {
return c;
}
}
I want to implement an extractor that will extract all accessible fields from similar objects.
Especially, I want to access annotation information.
I wonder, what is the best way to implement that extractor?
In this example I would like to extract names and values for (a, b, c) and know which are annotated with @Hashed annotation.
I was using previously BeanWrapperImpl (from spring) and Introspector.
However, I couldn't find methods to access annotations from properties.
Are annotations in fact allowed in beans?