xmlClassDesc = new XMLClassDescriptorAdapter(extendsDesc, null, primitiveNodeType);
}
}
setExtends(xmlClassDesc);
FieldDescriptor identity = classDesc.getIdentity();
FieldDescriptor[] fields = classDesc.getFields();
//-- Note from Keith for anyone interested...
//-- hack for multiple identities if ClassDescriptor is
//-- an implementation of ClassDescriptorImpl...
//-- This is really a bug in ClassDescriptorImpl, but
//-- since it's shared code between JDO + XML I don't
//-- want to change it there until both the XML and JDO
//-- folks can both approve the change.
if (classDesc instanceof ClassDescriptorImpl) {
ClassDescriptorImpl cdImpl = (ClassDescriptorImpl)classDesc;
FieldDescriptor[] identities = cdImpl.getIdentities();
if ((identities != null) && (identities.length > 1)) {
int size = fields.length + identities.length;
FieldDescriptor[] newFields = new FieldDescriptor[size];
System.arraycopy(fields, 0, newFields, 0, fields.length);
System.arraycopy(identities, 0, newFields, fields.length, identities.length);
fields = newFields;
}
}
//-- End ClassDescriptorImpl fix
for (int i = 0; i < fields.length; i++) {
FieldDescriptor fieldDesc = fields[i];
if (fieldDesc == null) {
continue;
}
if (fieldDesc instanceof XMLFieldDescriptorImpl) {
if (identity == fieldDesc) {
setIdentity((XMLFieldDescriptorImpl)fieldDesc);
identity = null; //-- clear identity
} else {
addFieldDescriptor((XMLFieldDescriptorImpl)fieldDesc);
}
} else {
String name = fieldDesc.getFieldName();
String xmlFieldName = _internalContext.getXMLNaming().toXMLName(name);
if (identity == fieldDesc) {
setIdentity(new XMLFieldDescriptorImpl(fieldDesc,
xmlFieldName,
NodeType.Attribute,
primitiveNodeType));
identity = null; //-- clear identity
} else {
NodeType nodeType = NodeType.Element;
if (isPrimitive(fieldDesc.getFieldType())) {
nodeType = primitiveNodeType;
}
addFieldDescriptor(new XMLFieldDescriptorImpl(fieldDesc,
xmlFieldName,