private static void adaptPropertyMap(AbstractPropertyMap source, AbstractPropertyMap target,
PropertyDefinitionMap definition, Object parent, boolean adaptReadonlyProperties) {
if ((adaptReadonlyProperties || !definition.isReadOnly()) && target == null) {
target = new PropertyMap(definition.getName());
add(parent, (PropertyMap) target);
}
for (Map.Entry<String, PropertyDefinition> e : definition.getPropertyDefinitions().entrySet()) {
String name = e.getKey();
PropertyDefinition def = e.getValue();
Property sourceChild = source.get(name);
if (sourceChild != null) {
Property targetChild = target.get(name);
adaptProperty(sourceChild, targetChild, def, target, adaptReadonlyProperties);
}
}
}