Remove yang-test
[controller.git] / opendaylight / config / config-manager-facade-xml / src / main / java / org / opendaylight / controller / config / facade / xml / mapping / attributes / toxml / SimpleCompositeAttributeWritingStrategy.java
1 /*
2  * Copyright (c) 2015, 2017 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 com.google.common.base.Preconditions;
12 import java.util.Map;
13 import org.opendaylight.controller.config.facade.xml.util.Util;
14 import org.w3c.dom.Document;
15
16 public class SimpleCompositeAttributeWritingStrategy extends SimpleAttributeWritingStrategy {
17
18     public SimpleCompositeAttributeWritingStrategy(final Document document, final String key) {
19         super(document, key);
20     }
21
22     @Override
23     protected Object preprocess(final Object value) {
24         Util.checkType(value, Map.class);
25         Preconditions.checkArgument(((Map<?, ?>) value).size() == 1, "Unexpected number of values in %s, expected 1",
26                 value);
27         return ((Map<?, ?>) value).values().iterator().next();
28     }
29 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.