Hi,
In the reflection library, is there a nice way to get the XML element name of a specific property? I am looking for a function similar to RuntimePropertyInfo.getName(), but one that returns the XML name.
I know about RuntimeClassInfo.getElementName(), but this gives the name bound to a class, not to a property.
The only solution I found so far was to search for the annotations myself:
try {
Field f = item.getClass().getDeclaredField(e.getName());
if(f.isAnnotationPresent(XmlElement.class)) {
ename = f.getAnnotation(XmlElement.class).name();
}
} catch (NoSuchFieldException e1) { }
but this doesn't always work. Does anyone know about a better way to do this?
Kind regards,
Ralf Kistner