BUG-1092: rename data.api.InstanceIdentifier to YangInstanceIdentifier
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / builder / impl / ImmutableUnkeyedListEntryNodeBuilder.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 package org.opendaylight.yangtools.yang.data.impl.schema.builder.impl;
9
10 import java.util.Map;
11
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
15 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
16 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
17 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerAttrNode;
18
19 public class ImmutableUnkeyedListEntryNodeBuilder extends
20         AbstractImmutableDataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> {
21
22     protected ImmutableUnkeyedListEntryNodeBuilder() {
23         super();
24     }
25
26     protected ImmutableUnkeyedListEntryNodeBuilder(final ImmutableUnkeyedListEntryNode node) {
27         super(node);
28     }
29
30     public static DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> create() {
31         return new ImmutableUnkeyedListEntryNodeBuilder();
32     }
33
34     public static DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> create(final UnkeyedListEntryNode node) {
35         if (!(node instanceof ImmutableUnkeyedListEntryNode)) {
36             throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
37         }
38         return new ImmutableUnkeyedListEntryNodeBuilder((ImmutableUnkeyedListEntryNode) node);
39     }
40
41     @Override
42     public UnkeyedListEntryNode build() {
43         return new ImmutableUnkeyedListEntryNode(getNodeIdentifier(), buildValue(), getAttributes());
44     }
45
46     protected static final class ImmutableUnkeyedListEntryNode extends
47             AbstractImmutableDataContainerAttrNode<YangInstanceIdentifier.NodeIdentifier> implements UnkeyedListEntryNode {
48
49         ImmutableUnkeyedListEntryNode(
50                 final YangInstanceIdentifier.NodeIdentifier nodeIdentifier,
51                 final Map<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> children,
52                 final Map<QName, String> attributes) {
53             super(children, nodeIdentifier, attributes);
54         }
55     }
56 }