Cleanup yang-data-impl nullness annotations
[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 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;
19
20 public class ImmutableUnkeyedListEntryNodeBuilder
21         extends AbstractImmutableDataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> {
22
23     protected ImmutableUnkeyedListEntryNodeBuilder() {
24
25     }
26
27     protected ImmutableUnkeyedListEntryNodeBuilder(final int sizeHint) {
28         super(sizeHint);
29     }
30
31     protected ImmutableUnkeyedListEntryNodeBuilder(final ImmutableUnkeyedListEntryNode node) {
32         super(node);
33     }
34
35     public static @NonNull DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create() {
36         return new ImmutableUnkeyedListEntryNodeBuilder();
37     }
38
39     public static @NonNull DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create(
40             final int sizeHint) {
41         return new ImmutableUnkeyedListEntryNodeBuilder(sizeHint);
42     }
43
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()));
48         }
49         return new ImmutableUnkeyedListEntryNodeBuilder((ImmutableUnkeyedListEntryNode) node);
50     }
51
52     @Override
53     public UnkeyedListEntryNode build() {
54         return new ImmutableUnkeyedListEntryNode(getNodeIdentifier(), buildValue(), getAttributes());
55     }
56
57     protected static final class ImmutableUnkeyedListEntryNode
58             extends AbstractImmutableDataContainerAttrNode<NodeIdentifier> implements UnkeyedListEntryNode {
59
60         ImmutableUnkeyedListEntryNode(final NodeIdentifier nodeIdentifier,
61                 final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> children,
62                 final Map<QName, String> attributes) {
63             super(children, nodeIdentifier, attributes);
64         }
65     }
66 }