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.builder.impl;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
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.DataContainerNodeBuilder;
17 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerNode;
19 public class ImmutableUnkeyedListEntryNodeBuilder
20 extends AbstractImmutableDataContainerNodeBuilder<NodeIdentifier, UnkeyedListEntryNode> {
22 protected ImmutableUnkeyedListEntryNodeBuilder() {
26 protected ImmutableUnkeyedListEntryNodeBuilder(final int sizeHint) {
30 protected ImmutableUnkeyedListEntryNodeBuilder(final ImmutableUnkeyedListEntryNode node) {
34 public static @NonNull DataContainerNodeBuilder<NodeIdentifier, UnkeyedListEntryNode> create() {
35 return new ImmutableUnkeyedListEntryNodeBuilder();
38 public static @NonNull DataContainerNodeBuilder<NodeIdentifier, UnkeyedListEntryNode> create(
40 return new ImmutableUnkeyedListEntryNodeBuilder(sizeHint);
43 public static @NonNull DataContainerNodeBuilder<NodeIdentifier, UnkeyedListEntryNode> create(
44 final UnkeyedListEntryNode node) {
45 if (!(node instanceof ImmutableUnkeyedListEntryNode)) {
46 throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
48 return new ImmutableUnkeyedListEntryNodeBuilder((ImmutableUnkeyedListEntryNode) node);
52 public UnkeyedListEntryNode build() {
53 return new ImmutableUnkeyedListEntryNode(getNodeIdentifier(), buildValue());
56 protected static final class ImmutableUnkeyedListEntryNode
57 extends AbstractImmutableDataContainerNode<NodeIdentifier> implements UnkeyedListEntryNode {
59 ImmutableUnkeyedListEntryNode(final NodeIdentifier nodeIdentifier,
60 final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> children) {
61 super(children, nodeIdentifier);