for (int i = 0; i < propertyDescriptors.length; i++) {
PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
properties.put(propertyDescriptor.getName(), propertyDescriptor.getPropertyType());
}
for (int i = 0; i < variableMappings.length; i++) {
VariableMappingType variableMapping = variableMappings[i];
String fieldName = variableMapping.getJavaVariableName().getStringValue().trim();
if (variableMapping.isSetXmlAttributeName()) {
AttributeDesc attributeDesc = new AttributeDesc();
attributeDesc.setFieldName(fieldName);
Class javaType = (Class) properties.get(fieldName);
if (javaType == null) {
throw new DeploymentException("field name " + fieldName + " not found in " + properties);
}
String attributeLocalName = variableMapping.getXmlAttributeName().getStringValue().trim();
QName xmlName = new QName("", attributeLocalName);
attributeDesc.setXmlName(xmlName);
SchemaLocalAttribute attribute = (SchemaLocalAttribute) attNameToType.get(attributeLocalName);
if (null == attribute) {
throw new DeploymentException("attribute " + xmlName + " not found in schema " + schemaType.getName());
}
attributeDesc.setXmlType(attribute.getType().getName());
fields[i] = attributeDesc;
} else {
ElementDesc elementDesc = new ElementDesc();
elementDesc.setFieldName(fieldName);
Class javaType = (Class) properties.get(fieldName);
if (javaType == null) {
//see if it is a public field
try {
Field field = javaClass.getField(fieldName);
javaType = field.getType();
} catch (NoSuchFieldException e) {
throw new DeploymentException("field name " + fieldName + " not found in " + properties, e);
}
}
QName xmlName = new QName("", variableMapping.getXmlElementName().getStringValue().trim());
SchemaParticle particle = (SchemaParticle) paramNameToType.get(xmlName);
if (null == particle) {
xmlName = new QName(ns, variableMapping.getXmlElementName().getStringValue().trim());
particle = (SchemaParticle) paramNameToType.get(xmlName);
if (null == particle) {
throw new DeploymentException("element " + xmlName + " not found in schema " + schemaType.getName());
}
} else if (SchemaParticle.ELEMENT != particle.getParticleType()) {