Add support for BigDecimal to netconf mapping.
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / resolving / SimpleAttributeResolvingStrategy.java
index 3b881579f1b4547ecdebbd287387a9b2b3f68aee..e1b8ecf17ee50c1a4895d73301025faabd5f88e6 100644 (file)
@@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
 
 import javax.management.openmbean.SimpleType;
 import java.lang.reflect.Method;
+import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Date;
 import java.util.Map;
@@ -65,6 +66,7 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
         resolverPlugins.put(Date.class.getCanonicalName(), new DateResolver());
         resolverPlugins.put(Character.class.getCanonicalName(), new CharResolver());
         resolverPlugins.put(BigInteger.class.getCanonicalName(), new BigIntegerResolver());
+        resolverPlugins.put(BigDecimal.class.getCanonicalName(), new BigDecimalResolver());
     }
 
     static interface Resolver {
@@ -106,6 +108,14 @@ final class SimpleAttributeResolvingStrategy extends AbstractAttributeResolvingS
         }
     }
 
+    static class BigDecimalResolver extends DefaultResolver {
+
+        @Override
+        protected Object parseObject(Class<?> type, String value) throws Exception {
+            return new BigDecimal(value);
+        }
+    }
+
     static class CharResolver extends DefaultResolver {
 
         @Override