Are there any java libraries which allow me to utilize BeanUtils like property access bean.prop1.prop2
while allowing access to the annotations on the getter/field itself?
For example, I have a bean class that looks like this:
public class Child {
@SomeCustomAnnotation
private String name;
//standard bean getter setters
}
public class Parent {
private Child child;
//standard bean getter setters
}
And I would like to be able to retrieve not only the value of the property I'm looking for but also any annotations annotated on that field that's value is being returned:
String childsName = SomeLibrary.getValue(parent, "child.name");
Annotation[] annotationsOnChildsName = SomeLibrary.getAnnotations(parent, "child.name");
Do any libraries exist which allow both features? I can use Commons BeanUtils to do pure property access for values and Plain Reflection to get the annotations on properties, but there doesn't seem to be a way to combine both abilities.
Unless I am missing something you can just the reflection's Field class