package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
-import java.util.List;
-
-import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.util.xml.XmlElement;
-public abstract class AbstractAttributeReadingStrategy<A extends AttributeIfc> implements AttributeReadingStrategy {
+import java.util.List;
+
+public abstract class AbstractAttributeReadingStrategy implements AttributeReadingStrategy {
- private final A attributeIfc;
+ private final String nullableDefault;
- public AbstractAttributeReadingStrategy(A attributeIfc) {
- this.attributeIfc = attributeIfc;
+ public AbstractAttributeReadingStrategy(String nullableDefault) {
+ this.nullableDefault = nullableDefault;
}
- public A getAttributeIfc() {
- return attributeIfc;
+ public String getNullableDefault() {
+ return nullableDefault;
}
@Override
- public AttributeConfigElement readElement(List<XmlElement> configNodes) {
- if (configNodes.size() == 0)
- return AttributeConfigElement.createNullValue(attributeIfc);
-
+ public AttributeConfigElement readElement(List<XmlElement> configNodes) throws NetconfDocumentedException {
+ if (configNodes.size() == 0){
+ return AttributeConfigElement.createNullValue(postprocessNullableDefault(nullableDefault));
+ }
return readElementHook(configNodes);
}
- abstract AttributeConfigElement readElementHook(List<XmlElement> configNodes);
+ abstract AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException;
+ protected Object postprocessNullableDefault(String nullableDefault) {
+ return nullableDefault;
+ }
}