if (_forceIntrospection && (!Types.isConstructable(cls))) {
throw new MappingException("mapping.classNotConstructable", cls.getName());
}
XMLClassDescriptor xmlClass;
FieldDescriptor[] fields;
ClassMapping classMap;
FieldMapping fieldMap;
boolean introspected = false;
try {
if (_forceIntrospection) {
xmlClass = _internalContext.getIntrospector().generateClassDescriptor(cls);
introspected = true;
} else {
xmlClass = (XMLClassDescriptor) _internalContext.getXMLClassDescriptorResolver().resolve(cls);
introspected = _internalContext.getIntrospector().introspected(xmlClass);
}
} catch (Exception except) {
throw new MappingException(except);
}
classMap = new ClassMapping();
classMap.setName(cls.getName());
classMap.setDescription("Default mapping for class " + cls.getName());
// -- prevent default access from showing up in the mapping
classMap.setAccess(null);
// -- map-to
MapTo mapTo = new MapTo();
mapTo.setXml(xmlClass.getXMLName());
mapTo.setNsUri(xmlClass.getNameSpaceURI());
mapTo.setNsPrefix(xmlClass.getNameSpacePrefix());
classMap.setMapTo(mapTo);
// -- add mapping to hashtable before processing
// -- fields so we can do recursive processing
_mappings.put(cls, classMap);
fields = xmlClass.getFields();
for (int i = 0; i < fields.length; ++i) {
FieldDescriptor fdesc = fields[i];
String fieldName = fdesc.getFieldName();