Fix wiring around sun.reflect
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / mapping / ArrayAttributeMappingStrategy.java
index 30436bb42f077c72de371e45fc5453849a40f9bc..a4eeb0c572339730f16c805a582c94133376f3ae 100644 (file)
@@ -8,16 +8,14 @@
 
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.mapping;
 
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
 import java.lang.reflect.Array;
 import java.util.List;
-
 import javax.management.openmbean.ArrayType;
 import javax.management.openmbean.OpenType;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-
 public class ArrayAttributeMappingStrategy extends AbstractAttributeMappingStrategy<List<Object>, ArrayType<?>> {
 
     private final AttributeMappingStrategy<?, ? extends OpenType<?>> innerElementStrategy;
@@ -30,8 +28,9 @@ public class ArrayAttributeMappingStrategy extends AbstractAttributeMappingStrat
 
     @Override
     public Optional<List<Object>> mapAttribute(Object value) {
-        if (value == null)
+        if (value == null){
             return Optional.absent();
+        }
 
         Preconditions.checkArgument(value.getClass().isArray(), "Value has to be instanceof Array ");
 
@@ -39,19 +38,11 @@ public class ArrayAttributeMappingStrategy extends AbstractAttributeMappingStrat
 
         for (int i = 0; i < Array.getLength(value); i++) {
             Object innerValue = Array.get(value, i);
-            // String expectedClassName =
-            // getOpenType().getElementOpenType().getClassName();
-            // String realClassName = value.getClass().getName();
-
-            // Preconditions.checkState(realClassName.contains(expectedClassName),
-            // "Element in collection/array should be of type " +
-            // expectedClassName + " but was "
-            // + realClassName + " for attribute: " + getOpenType());
-
             Optional<?> mapAttribute = innerElementStrategy.mapAttribute(innerValue);
 
-            if (mapAttribute.isPresent())
+            if (mapAttribute.isPresent()){
                 retVal.add(mapAttribute.get());
+            }
         }
 
         return Optional.of(retVal);