config-manager-facade-xml: final parameters
[controller.git] / opendaylight / config / config-manager-facade-xml / src / main / java / org / opendaylight / controller / config / facade / xml / mapping / attributes / toxml / ArrayAttributeWritingStrategy.java
1 /*
2  * Copyright (c) 2015 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.config.facade.xml.mapping.attributes.toxml;
10
11 import java.util.List;
12 import org.opendaylight.controller.config.facade.xml.util.Util;
13 import org.w3c.dom.Element;
14
15 public class ArrayAttributeWritingStrategy implements AttributeWritingStrategy {
16
17     private final AttributeWritingStrategy innnerStrategy;
18
19     public ArrayAttributeWritingStrategy(final AttributeWritingStrategy innerStrategy) {
20         this.innnerStrategy = innerStrategy;
21     }
22
23     @Override
24     public void writeElement(final Element parentElement, final String namespace, final Object value) {
25         Util.checkType(value, List.class);
26
27         for (Object innerObject : ((List<?>) value)) {
28             innnerStrategy.writeElement(parentElement, namespace, innerObject);
29         }
30
31     }
32
33 }