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.base.serializer;
10 import java.util.Collections;
12 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
13 import org.opendaylight.yangtools.yang.data.impl.schema.transform.FromNormalizedNodeSerializer;
14 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
17 * Abstract(base) serializer for LeafSetEntryNodes, serializes elements of type E.
19 * @param <E> type of serialized elements
21 public abstract class LeafSetEntryNodeBaseSerializer<E> implements
22 FromNormalizedNodeSerializer<E, LeafSetEntryNode<?>, LeafListSchemaNode> {
25 public final Iterable<E> serialize(LeafListSchemaNode schema, LeafSetEntryNode<?> node) {
26 return Collections.singletonList(serializeLeaf(schema, node));
31 * Serialize the inner value of a LeafSetEntryNode into element of type E.
33 * @param node to be serialized
34 * @param schema schema for leaf-list
35 * @return serialized inner value as an Element
37 protected abstract E serializeLeaf(LeafListSchemaNode schema, LeafSetEntryNode<?> node);