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
8 package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
12 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
13 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
14 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
15 import org.opendaylight.yangtools.yang.data.impl.schema.transform.base.serializer.LeafSetEntryNodeBaseSerializer;
16 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
17 import org.w3c.dom.Document;
18 import org.w3c.dom.Element;
20 public class LeafSetEntryNodeDomSerializer extends
21 LeafSetEntryNodeBaseSerializer<Element> {
23 private final Document doc;
24 private final XmlCodecProvider codecProvider;
26 public LeafSetEntryNodeDomSerializer(Document doc, XmlCodecProvider codecProvider) {
27 this.doc = Preconditions.checkNotNull(doc);
28 this.codecProvider = Preconditions.checkNotNull(codecProvider);
32 protected Element serializeLeaf(LeafListSchemaNode schema, LeafSetEntryNode<?> node) {
33 Element itemEl = XmlDocumentUtils.createElementFor(doc, node);
35 DomUtils.serializeXmlValue(itemEl, schema.getType(), codecProvider, node.getValue());