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.common.QName;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
16 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
17 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
18 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerAttrNode;
20 public class ImmutableUnkeyedListEntryNodeBuilder
21 extends AbstractImmutableDataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> {
23 protected ImmutableUnkeyedListEntryNodeBuilder() {
27 protected ImmutableUnkeyedListEntryNodeBuilder(final int sizeHint) {
31 protected ImmutableUnkeyedListEntryNodeBuilder(final ImmutableUnkeyedListEntryNode node) {
35 public static @NonNull DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create() {
36 return new ImmutableUnkeyedListEntryNodeBuilder();
39 public static @NonNull DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create(
41 return new ImmutableUnkeyedListEntryNodeBuilder(sizeHint);
44 public static @NonNull DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create(
45 final UnkeyedListEntryNode node) {
46 if (!(node instanceof ImmutableUnkeyedListEntryNode)) {
47 throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
49 return new ImmutableUnkeyedListEntryNodeBuilder((ImmutableUnkeyedListEntryNode) node);
53 public UnkeyedListEntryNode build() {
54 return new ImmutableUnkeyedListEntryNode(getNodeIdentifier(), buildValue(), getAttributes());
57 protected static final class ImmutableUnkeyedListEntryNode
58 extends AbstractImmutableDataContainerAttrNode<NodeIdentifier> implements UnkeyedListEntryNode {
60 ImmutableUnkeyedListEntryNode(final NodeIdentifier nodeIdentifier,
61 final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> children,
62 final Map<QName, String> attributes) {
63 super(children, nodeIdentifier, attributes);