2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
11 import com.google.common.collect.Lists;
12 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
13 import org.opendaylight.controller.netconf.util.xml.XmlElement;
15 import java.util.List;
17 public class ArrayAttributeReadingStrategy extends AbstractAttributeReadingStrategy {
19 private final AttributeReadingStrategy innerStrategy;
23 * @param innerStrategy
25 public ArrayAttributeReadingStrategy(String nullableDefault, AttributeReadingStrategy innerStrategy) {
26 super(nullableDefault);
27 this.innerStrategy = innerStrategy;
31 AttributeConfigElement readElementHook(List<XmlElement> configNodes) throws NetconfDocumentedException {
32 List<Object> innerList = Lists.newArrayList();
33 for (int i = 0; i < configNodes.size(); i++) {
34 innerList.add(innerStrategy.readElement(Lists.newArrayList(configNodes.get(i))).getValue());
36 return AttributeConfigElement.create(getNullableDefault(), innerList);