for( Field field : jaxbCmdClass.getDeclaredFields() ) {
String fullFieldName = jaxbCmdClass.getSimpleName() + "." + field.getName();
field.setAccessible(true);
// check that type matches
XmlElement xmlElem = ((XmlElement) field.getAnnotation(XmlElement.class));
XmlAttribute xmlAttribute = ((XmlAttribute) field.getAnnotation(XmlAttribute.class));
if( xmlElem != null ) {
String xmlElemName = xmlElem.name();
if( xmlElemName != null && xmlElemName.equals(PROCESS_INSTANCE_ID_NAME) ) {
assertTrue( fullFieldName + " is an incorrect type! (" + field.getType() + ")",
field.getType().equals(Long.class) || field.getType().equals(long.class) );
}
} else if (xmlAttribute != null) {
String xmlAttributeName = xmlAttribute.name();
if( xmlAttributeName != null && xmlAttributeName.equals(PROCESS_INSTANCE_ID_NAME) ) {
assertTrue( fullFieldName + " is an incorrect type! (" + field.getType() + ")",
field.getType().equals(Long.class) || field.getType().equals(long.class) );
}
}
// check that field has correct XmlElement name
String name = field.getName().toLowerCase();
if( name.startsWith("proc") && name.contains("inst")
&& ! name.endsWith("s") && ! name.endsWith("list")) {
xmlElem = ((XmlElement) field.getAnnotation(XmlElement.class));
xmlAttribute = ((XmlAttribute) field.getAnnotation(XmlAttribute.class));
String xmlElemName = null;
String xmlAttrName = null;
if( xmlElem != null ) {
xmlElemName = xmlElem.name();
}
if( xmlAttribute != null ) {
xmlAttrName = xmlAttribute.name();
}
if( "processInstanceId".equals(field.getName()) ) {
continue;
}
if( xmlElemName != null ) {