if (propertyDescriptors != null) {
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
if (propertyName.equals(propertyDescriptor.getName())) {
Method writeMethod = propertyDescriptor.getWriteMethod();
if (writeMethod != null) {
Required annotation = writeMethod.getAnnotation(Required.class);
if (annotation != null) {
return true;
}
if (useMethods) {
XmlElement element = writeMethod.getAnnotation(XmlElement.class);
if (element != null && element.required()) {
return true;
}
XmlAttribute attribute = writeMethod.getAnnotation(XmlAttribute.class);
if (attribute != null && attribute.required()) {
return true;
}
}
}
break;
}
}
}
if (!useMethods) {
Field[] fields = camelClass.getDeclaredFields();
for (Field field : fields) {
if (propertyName.equals(field.getName())) {
Required annotation = field.getAnnotation(Required.class);
if (annotation != null) {
return true;
}
XmlElement element = field.getAnnotation(XmlElement.class);
if (element != null && element.required()) {