X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fconfig-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fconfignetconfconnector%2Fmapping%2Fattributes%2Ffromxml%2FAttributeConfigElement.java;h=2b081258c42014e880846330994ea2dbb84147b8;hb=c4d4ae571f2d6bcd968ffa5e04833999b86ffa6e;hp=598935a0bc4f15ddcc61039723e313d55c0d9860;hpb=16f2dc509f9f9429447bf9dc59c6c56cd09a7fc3;p=controller.git diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AttributeConfigElement.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AttributeConfigElement.java index 598935a0bc..2b081258c4 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AttributeConfigElement.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/fromxml/AttributeConfigElement.java @@ -9,7 +9,7 @@ package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml; import com.google.common.base.Optional; -import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc; +import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.resolving.AttributeResolvingStrategy; import javax.management.openmbean.OpenType; @@ -19,15 +19,15 @@ import javax.management.openmbean.OpenType; * of some module. Contains default value extracted from yang file. */ public class AttributeConfigElement { - private final Object dafaultValue; + private final Object defaultValue; private final Object value; private Optional resolvedValue; private Object resolvedDefaultValue; private String jmxName; - public AttributeConfigElement(Object dafaultValue, Object value) { - this.dafaultValue = dafaultValue; + public AttributeConfigElement(Object defaultValue, Object value) { + this.defaultValue = defaultValue; this.value = value; } @@ -40,35 +40,28 @@ public class AttributeConfigElement { } public void resolveValue(AttributeResolvingStrategy> attributeResolvingStrategy, - String attrName) { + String attrName) throws NetconfDocumentedException { resolvedValue = attributeResolvingStrategy.parseAttribute(attrName, value); - Optional resolvedDefault = attributeResolvingStrategy.parseAttribute(attrName, dafaultValue); + Optional resolvedDefault = attributeResolvingStrategy.parseAttribute(attrName, defaultValue); resolvedDefaultValue = resolvedDefault.isPresent() ? resolvedDefault.get() : null; - - } - - public static AttributeConfigElement create(AttributeIfc attributeIfc, Object value) { - String nullableDefault = attributeIfc.getNullableDefault(); - return create(nullableDefault, value); } - public static AttributeConfigElement create(String nullableDefault, Object value) { + public static AttributeConfigElement create(Object nullableDefault, Object value) { return new AttributeConfigElement(nullableDefault, value); } - public static AttributeConfigElement createNullValue(AttributeIfc attributeIfc) { - return new AttributeConfigElement(attributeIfc.getNullableDefault(), null); - } - - public static AttributeConfigElement createNullValue(String nullableDefault) { + public static AttributeConfigElement createNullValue(Object nullableDefault) { return new AttributeConfigElement(nullableDefault, null); } - public Object getValue() { return value; } + public Object getDefaultValue() { + return defaultValue; + } + public Optional getResolvedValue() { return resolvedValue; } @@ -79,7 +72,7 @@ public class AttributeConfigElement { @Override public String toString() { - return "AttributeConfigElement [dafaultValue=" + dafaultValue + ", value=" + value + "]"; + return "AttributeConfigElement [defaultValue=" + defaultValue + ", value=" + value + "]"; } }