Merge "Prevent password hash from being shown"
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / fromxml / SimpleAttributeReadingStrategy.java
index c5c287ffe2acf7561864dc5044d59eaaebce7bfe..a8605243af3f77f587563d453ea69d51401f2aa4 100644 (file)
@@ -9,23 +9,14 @@
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
 
 import com.google.common.base.Preconditions;
-import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 
-import javax.management.openmbean.OpenType;
 import java.util.List;
 
-public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStrategy<AttributeIfc> {
+public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStrategy {
 
-    public SimpleAttributeReadingStrategy(AttributeIfc attributeIfc) {
-        super(attributeIfc);
-    }
-
-    /**
-     * @param elementOpenType
-     */
-    public SimpleAttributeReadingStrategy(OpenType<?> elementOpenType) {
-        super(new AttributeIfcWrapper(elementOpenType));
+    public SimpleAttributeReadingStrategy(String nullableDefault) {
+        super(nullableDefault);
     }
 
     @Override
@@ -37,50 +28,17 @@ public class SimpleAttributeReadingStrategy extends AbstractAttributeReadingStra
         String textContent = xmlElement.getTextContent();
 
         Preconditions.checkNotNull(textContent, "This element should contain text %s", xmlElement);
-        return AttributeConfigElement.create(getAttributeIfc(), textContent);
+        return AttributeConfigElement.create(postprocessNullableDefault(getNullableDefault()),
+                postprocessParsedValue(textContent));
     }
 
-    /**
-     * Wrapper for JavaAttribute inner element attributes (in case JavaAttribute
-     * is array)
-     */
-    static class AttributeIfcWrapper implements AttributeIfc {
-
-        private final OpenType<?> elementOpenType;
-
-        public AttributeIfcWrapper(OpenType<?> elementOpenType) {
-            this.elementOpenType = elementOpenType;
-        }
-
-        @Override
-        public String getAttributeYangName() {
-            return null;
-        }
-
-        @Override
-        public String getNullableDescription() {
-            return null;
-        }
-
-        @Override
-        public String getNullableDefault() {
-            return null;
-        }
-
-        @Override
-        public String getUpperCaseCammelCase() {
-            return null;
-        }
-
-        @Override
-        public String getLowerCaseCammelCase() {
-            return null;
-        }
-
-        @Override
-        public OpenType<?> getOpenType() {
-            return elementOpenType;
-        }
+    @Override
+    protected Object postprocessNullableDefault(String nullableDefault) {
+        return nullableDefault;
+    }
 
+    protected Object postprocessParsedValue(String textContent) {
+        return textContent;
     }
+
 }