target = object;
}
// Read attributes
while (reader.hasMoreAttributeReaders()) {
MessageReader childReader = reader.getNextAttributeReader();
QName name = childReader.getName();
AegisType type = inf.getType(name);
if (type != null) {
Object writeObj = type.readObject(childReader, context);
writeProperty(name, target, writeObj, clazz, inf);
}
}
// Read child elements
while (reader.hasMoreElementReaders()) {
MessageReader childReader = reader.getNextElementReader();
QName name = childReader.getName();
// Find the BeanTypeInfo that contains a property for the element name
BeanTypeInfo propertyTypeInfo = getBeanTypeInfoWithProperty(name);
// Get the AegisType for the property
AegisType type = getElementType(name, propertyTypeInfo, childReader, context);
if (type != null) {
if (!childReader.isXsiNil()) {
Object writeObj;
if (type.isFlatArray()) {
ArrayType aType = (ArrayType) type;
PropertyDescriptor desc = inf.getPropertyDescriptorFromMappedName(name);
boolean isList = List.class.isAssignableFrom(desc.getPropertyType());
writeObj = aType.readObject(childReader, name, context, !isList);
} else {
writeObj = type.readObject(childReader, context);
}
writeProperty(name, target, writeObj, clazz, propertyTypeInfo);
} else {
if (!alwaysAllowNillables() && !propertyTypeInfo.isNillable(name)) {
throw new DatabindingException(name.getLocalPart()
+ " is nil, but not nillable.");
}
childReader.readToEnd();
}
} else {
childReader.readToEnd();
}
}
return object;
} catch (IllegalAccessException e) {