if (superTypeInfo == null){
return;
}
XMLDescriptor superDescriptor = superTypeInfo.getDescriptor();
if (superDescriptor != null) {
XMLSchemaReference sRef = descriptor.getSchemaReference();
if (sRef == null || sRef.getSchemaContext() == null) {
return;
}
JavaClass rootMappedSuperClass = getRootMappedSuperClass(superClass);
TypeInfo rootTypeInfo = typeInfo.get(rootMappedSuperClass.getName());
XMLDescriptor rootDescriptor = rootTypeInfo.getDescriptor();
if (rootDescriptor.getNamespaceResolver() == null) {
rootDescriptor.setNamespaceResolver(new NamespaceResolver());
}
if (rootDescriptor.getInheritancePolicy().getClassIndicatorField() == null) {
XMLField classIndicatorField;
if (rootTypeInfo.isSetXmlDiscriminatorNode()) {
classIndicatorField = new XMLField(rootTypeInfo.getXmlDiscriminatorNode());
} else {
classIndicatorField = new XMLField(ATT + "type");
classIndicatorField.getXPathFragment().setNamespaceURI(XMLConstants.SCHEMA_INSTANCE_URL);
}
rootDescriptor.getInheritancePolicy().setClassIndicatorField(classIndicatorField);
}
Object sCtx = null;
//TypeInfo tInfo = typeInfo.get(jClass.getName());
if (tInfo.isSetXmlDiscriminatorValue()) {
sCtx = tInfo.getXmlDiscriminatorValue();
} else if(!tInfo.isAnonymousComplexType()){
sCtx = sRef.getSchemaContextAsQName();
}
if(sCtx != null) {
descriptor.getInheritancePolicy().setParentClassName(superClass.getName());
rootDescriptor.getInheritancePolicy().addClassNameIndicator(jClass.getName(), sCtx);
}
Object value = rootDescriptor.getInheritancePolicy().getClassNameIndicatorMapping().get(rootDescriptor.getJavaClassName());
if (value == null){
if (rootTypeInfo.isSetXmlDiscriminatorValue()) {
rootDescriptor.getInheritancePolicy().addClassNameIndicator(rootDescriptor.getJavaClassName(), rootTypeInfo.getXmlDiscriminatorValue());
} else {
XMLSchemaReference rootSRef = rootDescriptor.getSchemaReference();
if (rootSRef != null && rootSRef.getSchemaContext() != null) {
QName rootSCtx = rootSRef.getSchemaContextAsQName();
rootDescriptor.getInheritancePolicy().addClassNameIndicator(rootDescriptor.getJavaClassName(), rootSCtx);
}
}
}
rootDescriptor.getInheritancePolicy().setShouldReadSubclasses(true);