import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
+import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.management.openmbean.OpenType;
import java.util.Map;
-final class CompositeAttributeResolvingStrategy extends
+class CompositeAttributeResolvingStrategy extends
AbstractAttributeResolvingStrategy<CompositeDataSupport, CompositeType> {
private final Map<String, AttributeResolvingStrategy<?, ? extends OpenType<?>>> innerTypes;
private final Map<String, String> yangToJavaAttrMapping;
}
@Override
- public Optional<CompositeDataSupport> parseAttribute(String attrName, Object value) {
+ public Optional<CompositeDataSupport> parseAttribute(String attrName, Object value) throws NetconfDocumentedException {
if (value == null) {
return Optional.absent();
Util.checkType(value, Map.class);
Map<?, ?> valueMap = (Map<?, ?>) value;
+ valueMap = preprocessValueMap(valueMap);
Map<String, Object> items = Maps.newHashMap();
Map<String, OpenType<?>> openTypes = Maps.newHashMap();
parsedInnerValue.isPresent() ? parsedInnerValue.get() : null);
}
- CompositeDataSupport parsedValue = null;
+ CompositeDataSupport parsedValue;
try {
parsedValue = new CompositeDataSupport(getOpenType(), items);
} catch (OpenDataException e) {
- throw new RuntimeException("An error occured during restoration of composite type " + this
+ throw new IllegalStateException("An error occured during restoration of composite type " + this
+ " for attribute " + attrName + " from value " + value, e);
}
return Optional.of(parsedValue);
}
+
+ protected Map<?, ?> preprocessValueMap(Map<?, ?> valueMap) {
+ return valueMap;
+ }
}