return ret;
}
private static void add(ConfigurationDefinition configurationDefinition, Configuration configuration,
PropertyDefinition parentDef, Property parentProp, Object propertyInstance) {
Property prop = null;
PropertyDefinition def = null;
if (propertyInstance instanceof SimplePropertyInstanceDescriptor) {
def = convert((ConfigurationProperty) propertyInstance);
def.setConfigurationDefinition(configurationDefinition);
SimplePropertyInstanceDescriptor simpleInstance = (SimplePropertyInstanceDescriptor) propertyInstance;
PropertySimple simpleProp = new PropertySimple(simpleInstance.getName(), simpleInstance.getValue());
prop = simpleProp;
} else if (propertyInstance instanceof ListPropertyInstanceDescriptor) {
def = convert((ConfigurationProperty) propertyInstance);
def.setConfigurationDefinition(configurationDefinition);
ListPropertyInstanceDescriptor listInstance = (ListPropertyInstanceDescriptor) propertyInstance;
PropertyList listProp = new PropertyList(listInstance.getName());
PropertyDefinition memberDefinition = ((PropertyDefinitionList) def).getMemberDefinition();
if (listInstance.getValues() != null) {
for (JAXBElement<?> val : listInstance.getValues().getComplexValue()) {
ComplexValueDescriptor valDesc = (ComplexValueDescriptor) val.getValue();
Property child = convert(memberDefinition, valDesc);
listProp.add(child);
}
}
prop = listProp;
} else if (propertyInstance instanceof MapPropertyInstanceDescriptor) {
def = convert((ConfigurationProperty) propertyInstance);
def.setConfigurationDefinition(configurationDefinition);
MapPropertyInstanceDescriptor mapInstance = (MapPropertyInstanceDescriptor) propertyInstance;
PropertyMap mapProp = new PropertyMap(mapInstance.getName());
if (mapInstance.getValues() != null) {
for (JAXBElement<?> val : mapInstance.getValues().getComplexValue()) {
ComplexValueDescriptor valueDesc = (ComplexValueDescriptor) val.getValue();
PropertyDefinition valueDefinition = ((PropertyDefinitionMap) def).get(valueDesc
.getPropertyName());
Property child = convert(valueDefinition, valueDesc);
mapProp.put(child);
}
}
prop = mapProp;