import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDependenciesAttribute;
import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute;
import org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.AttributeIfcSwitchStatement;
-import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.Services;
+import org.opendaylight.controller.netconf.confignetconfconnector.mapping.config.ServiceRegistryWrapper;
import javax.management.openmbean.ArrayType;
import javax.management.openmbean.CompositeType;
public class ObjectMapper extends AttributeIfcSwitchStatement<AttributeMappingStrategy<?, ? extends OpenType<?>>> {
- private final Services dependencyTracker;
+ private final ServiceRegistryWrapper dependencyTracker;
- public ObjectMapper(Services depTracker) {
+ public ObjectMapper(ServiceRegistryWrapper depTracker) {
this.dependencyTracker = depTracker;
}
return new CompositeAttributeMappingStrategy(openType, innerStrategies, attributeMapping);
}
+ @Override
+ protected AttributeMappingStrategy<?, ? extends OpenType<?>> caseJavaUnionAttribute(OpenType<?> openType) {
+ Map<String, AttributeMappingStrategy<?, ? extends OpenType<?>>> innerStrategies = Maps.newHashMap();
+
+ Map<String, String> attributeMapping = Maps.newHashMap();
+
+ CompositeType compositeType = (CompositeType) openType;
+ for (String innerAttributeKey : compositeType.keySet()) {
+
+ innerStrategies.put(innerAttributeKey, caseJavaAttribute(compositeType.getType(innerAttributeKey)));
+ attributeMapping.put(innerAttributeKey, innerAttributeKey);
+ }
+
+ return new UnionCompositeAttributeMappingStrategy(compositeType, innerStrategies, attributeMapping);
+ }
+
private String serviceNameOfDepAttr;
private String namespaceOfDepAttr;