89dc251b4eb91e1b06879623e931aa5ca477be5e
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / toxml / ArrayAttributeWritingStrategy.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.toxml;
10
11 import java.util.List;
12
13 import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
14 import org.w3c.dom.Element;
15
16 public class ArrayAttributeWritingStrategy implements AttributeWritingStrategy {
17
18     private final AttributeWritingStrategy innnerStrategy;
19
20     public ArrayAttributeWritingStrategy(AttributeWritingStrategy innerStrategy) {
21         this.innnerStrategy = innerStrategy;
22     }
23
24     @Override
25     public void writeElement(Element parentElement, String namespace, Object value) {
26         Util.checkType(value, List.class);
27
28         for (Object innerObject : ((List<?>) value)) {
29             innnerStrategy.writeElement(parentElement, namespace, innerObject);
30         }
31
32     }
33
34 }