TypeInfo info = this.typeInfo.get(javaClass.getQualifiedName());
XMLDescriptor descriptor = (XMLDescriptor)info.getDescriptor();
if(!info.getObjectGraphs().isEmpty()) {
for(XmlNamedObjectGraph next:info.getObjectGraphs()) {
AttributeGroup group = descriptor.getAttributeGroup(next.getName());
Map<String, List<CoreAttributeGroup>> subgraphs = processSubgraphs(next.getXmlNamedSubgraph());
for(XmlNamedAttributeNode nextAttributeNode:next.getXmlNamedAttributeNode()) {
if(nextAttributeNode.getSubgraph() == null || nextAttributeNode.getSubgraph().length() == 0) {
group.addAttribute(nextAttributeNode.getName());
} else {
List<CoreAttributeGroup> nestedGroups = subgraphs.get(nextAttributeNode.getSubgraph());
if(nestedGroups == null || nestedGroups.isEmpty()) {
Property property = info.getProperties().get(nextAttributeNode.getName());
JavaClass cls = property.getActualType();
TypeInfo referenceType = typeInfo.get(cls.getQualifiedName());
if(referenceType != null) {
AttributeGroup targetGroup = (AttributeGroup)referenceType.getDescriptor().getAttributeGroup(nextAttributeNode.getSubgraph());
group.addAttribute(nextAttributeNode.getName(), targetGroup);
} else {
//TODO: Exception
}
} else {
if(nestedGroups.size() == 1) {
group.addAttribute(nextAttributeNode.getName(), nestedGroups.get(0));
} else {
group.addAttribute(nextAttributeNode.getName(), nestedGroups);
}
}
}
}
for(XmlNamedSubgraph nextSubclass:next.getXmlNamedSubclassGraph()) {
AttributeGroup subclassGroup = new AttributeGroup(next.getName(), nextSubclass.getType(), true);
group.getSubClassGroups().put(nextSubclass.getType(), subclassGroup);
for(XmlNamedAttributeNode nextAttributeNode:nextSubclass.getXmlNamedAttributeNode()) {
if(nextAttributeNode.getSubgraph() == null || nextAttributeNode.getSubgraph().length() == 0) {
subclassGroup.addAttribute(nextAttributeNode.getName());
} else {
List<CoreAttributeGroup> nestedGroups = subgraphs.get(nextAttributeNode.getSubgraph());
if(nestedGroups == null || nestedGroups.isEmpty()) {
Property property = info.getProperties().get(nextAttributeNode.getName());
JavaClass cls = property.getActualType();
TypeInfo referenceType = typeInfo.get(cls.getQualifiedName());
if(referenceType != null) {
AttributeGroup targetGroup = (AttributeGroup)referenceType.getDescriptor().getAttributeGroup(nextAttributeNode.getSubgraph());
subclassGroup.addAttribute(nextAttributeNode.getName(), targetGroup);
} else {
//TODO: Exception
}
} else {