}
if (mainmapping != null) {
// find the binding containing this mapping
String uri = qname.getUri();
BindingHolder hold = m_directory.getBinding(uri);
if (mainmapping.isAbstract()) {
hold.addTypeNameReference(uri, uri);
}
// check for superclass mapping to be extended (do this first for compatibility with schema type extension)
StructureElement struct = null;
String ptype = detail.getExtendsType();
Map exmembmap = Collections.EMPTY_MAP;
Map inmembmap = new HashMap();
if (ptype == null) {
// not extending a base mapping, check if need to include superclass
IClass parent = clas.getSuperClass();
if (cust.isUseSuper() && parent != null) {
ptype = parent.getName();
if (checkInclude(ptype)) {
struct = new StructureElement();
struct.setDeclaredType(ptype);
ClassCustom scust = m_global.getClassCustomization(ptype);
exmembmap = new HashMap();
fillStructure(scust, null, exmembmap, struct, hold);
}
}
} else {
// create reference to parent mapping
struct = new StructureElement();
BindingMappingDetail pdetail = (BindingMappingDetail)m_mappingDetailsMap.get(ptype);
if (!pdetail.isGenerated()) {
addMapping(ptype, pdetail);
}
exmembmap = pdetail.getAccessMethodMap();
if (pdetail.isUseAbstract()) {
// reference abstract mapped superclass
QName tname = pdetail.getTypeQName();
if (tname == null) {
throw new IllegalStateException("Internal error: unimplemented case of superclass " + ptype
+ " to be extended by subclass " + type + ", without an abstract <mapping> ");
} else {
uri = tname.getUri();
hold.addTypeNameReference(uri, uri);
struct.setMapAsQName(tname);
}
} else {
// reference concrete mapped superclass
struct.setMapAsName(ptype);
}
// set extension for child concrete mapping
if (mapcon != null) {
mapcon.setExtendsName(ptype);
}
}
// add extension reference structure to mapping
if (struct != null) {
mainmapping.addChild(struct);
}
// add all details of class member handling to binding
inmembmap.putAll(exmembmap);
addMemberBindings(cust, exmembmap, inmembmap, mainmapping, hold);
hold.addMapping(mainmapping);
if (mapabs != null && mapcon != null) {
// define content as structure reference to abstract mapping
struct = new StructureElement();
QName tname = detail.getTypeQName();
uri = tname.getUri();
hold.addTypeNameReference(uri, uri);
struct.setMapAsQName(tname);
mapcon.addChild(struct);
hold.addMapping(mapcon);
}
// set the member property map for mapping
detail.setAccessMethodMap(inmembmap);