private static void writeMapContent(Map<ObjectBinding, ObjectBinding> value, Set<String> beansProcessed, StringBuffer buffer,
int indent) {
pad(indent, buffer);
buffer.append("<map>\n");
for (ObjectBinding mapKey : value.keySet()) {
ObjectBinding mapValue = value.get(mapKey);
pad(indent + 1, buffer);
buffer.append("<entry>\n");
pad(indent + 2, buffer);
buffer.append("<key>\n");
if (mapKey.getDescriptor().getType() == BeanDescriptor.TYPE_BASE) {
writeSimplePropertyValue(mapKey, buffer, indent + 3);
} else {
if (mapKey.isNested() && !beansProcessed.contains(mapKey.getDescriptor().getId()))
writeBean(mapKey.getDescriptor(), buffer, beansProcessed, indent + 3);
else
writeRef(mapKey.getDescriptor().getId(), buffer, indent + 3);
}
pad(indent + 2, buffer);
buffer.append("</key>\n");
if (mapValue.getDescriptor().getBean() == null) {
writeNull(buffer, indent + 2);
} else if (mapValue.getDescriptor().getType() == BeanDescriptor.TYPE_BASE) {
writeSimplePropertyValue(mapValue, buffer, indent + 2);
} else if (mapValue.getDescriptor().getType() == BeanDescriptor.TYPE_LIST) {
writeListContent(mapValue.getDescriptor().getListProperty(BeanDescriptor.PROPERTY_CONTENT), beansProcessed, buffer,
indent + 2);
} else if (mapValue.getDescriptor().getType() == BeanDescriptor.TYPE_SET) {
writeSetContent(mapValue.getDescriptor().getSetProperty(BeanDescriptor.PROPERTY_CONTENT), beansProcessed, buffer,
indent + 2);
} else if (mapValue.getDescriptor().getType() == BeanDescriptor.TYPE_MAP) {
writeMapContent(mapValue.getDescriptor().getMapProperty(BeanDescriptor.PROPERTY_CONTENT), beansProcessed, buffer,
indent + 2);
} else {
if (mapValue.isNested() && !beansProcessed.contains(mapValue.getDescriptor().getId())) {
writeBean(mapValue.getDescriptor(), buffer, beansProcessed, indent + 2);
} else {
writeRef(mapValue.getDescriptor().getId(), buffer, indent + 2);
}
}
pad(indent + 1, buffer);
buffer.append("</entry>\n");
}