for (int i=0; i<propertyDescriptor.length; i++) {
String propName = propertyDescriptor[i].getName();
if (propName.equals("class"))
continue;
FieldDesc field = typeDesc.getFieldByName(propName);
// skip it if its not an attribute
if (field == null || field.isElement())
continue;
QName qname = field.getXmlName();
if (qname == null) {
qname = new QName("", propName);
}
if (propertyDescriptor[i].isReadable() &&
!propertyDescriptor[i].isIndexed()) {
// add to our attributes
Object propValue = propertyDescriptor[i].get(value);
// Convert true/false to 1/0 in case of soapenv:mustUnderstand
if (qname.equals(MUST_UNDERSTAND_QNAME)) {
if (propValue.equals(Boolean.TRUE)) {
propValue = "1";
} else if (propValue.equals(Boolean.FALSE)) {
propValue = "0";
}
}
// If the property value does not exist, don't serialize
// the attribute. In the future, the decision to serializer
// the attribute may be more sophisticated. For example, don't
// serialize if the attribute matches the default value.
if (propValue != null) {
setAttributeProperty(propValue,
qname,
field.getXmlType(),
attrs,
context);
}
}
}