if (referenceDescriptor != null && referenceDescriptor == descriptor) {
return false;
}
if (descriptor.hasInheritance() && !descriptor.getInheritancePolicy().isRootParentDescriptor()) {
CoreInheritancePolicy inheritancePolicy = descriptor.getInheritancePolicy();
Field indicatorField = (Field) inheritancePolicy.getClassIndicatorField();
if (indicatorField != null && xsiTypeIndicatorField) {
Object classIndicatorValueObject = inheritancePolicy.getClassIndicatorMapping().get(descriptor.getJavaClass());
String classIndicatorUri = null;
String classIndicatorLocal= null;
String classIndicatorPrefix= null;
if (classIndicatorValueObject instanceof QName) {
QName classIndicatorQName = (QName) classIndicatorValueObject;
classIndicatorUri = classIndicatorQName.getNamespaceURI();
classIndicatorLocal = classIndicatorQName.getLocalPart();
classIndicatorPrefix = classIndicatorQName.getPrefix();
} else {
String classIndicatorValue = (String) inheritancePolicy.getClassIndicatorMapping().get(descriptor.getJavaClass());
int nsindex = classIndicatorValue.indexOf(Constants.COLON);
String prefix = null;
if (nsindex != -1) {
classIndicatorLocal = classIndicatorValue.substring(nsindex + 1);
prefix = classIndicatorValue.substring(0, nsindex);
} else {
classIndicatorLocal = classIndicatorValue;
}
classIndicatorUri = descriptor.getNonNullNamespaceResolver().resolveNamespacePrefix(prefix);
}
if(leafType == null
|| isRootElement && marshaller.getMediaType().isApplicationJSON() && !marshaller.isIncludeRoot()
|| !(leafType.getLocalPart().equals(classIndicatorLocal))
|| (classIndicatorUri == null && (leafType.getNamespaceURI() != null && leafType.getNamespaceURI().length() >0))
|| (classIndicatorUri != null && !classIndicatorUri.equals(leafType.getNamespaceURI()))
){
if (inheritancePolicy.hasClassExtractor()) {
objectBuilder.addClassIndicatorFieldToRow(this);
} else {
writeXsiTypeAttribute(descriptor, classIndicatorUri, classIndicatorLocal,classIndicatorPrefix, isRootElement);
}
return true;