Cleanup checkstyle warnings and turn enforcement on in yang-data-impl
[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.opendaylight.yangtools.yang.common.QName;
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.DataContainerNodeAttrBuilder;
17 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerAttrNode;
18
19 public class ImmutableUnkeyedListEntryNodeBuilder
20         extends AbstractImmutableDataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> {
21
22     protected ImmutableUnkeyedListEntryNodeBuilder() {
23
24     }
25
26     protected ImmutableUnkeyedListEntryNodeBuilder(final int sizeHint) {
27         super(sizeHint);
28     }
29
30     protected ImmutableUnkeyedListEntryNodeBuilder(final ImmutableUnkeyedListEntryNode node) {
31         super(node);
32     }
33
34     public static DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create() {
35         return new ImmutableUnkeyedListEntryNodeBuilder();
36     }
37
38     public static DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create(final int sizeHint) {
39         return new ImmutableUnkeyedListEntryNodeBuilder(sizeHint);
40     }
41
42     public static DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> create(
43             final UnkeyedListEntryNode node) {
44         if (!(node instanceof ImmutableUnkeyedListEntryNode)) {
45             throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
46         }
47         return new ImmutableUnkeyedListEntryNodeBuilder((ImmutableUnkeyedListEntryNode) node);
48     }
49
50     @Override
51     public UnkeyedListEntryNode build() {
52         return new ImmutableUnkeyedListEntryNode(getNodeIdentifier(), buildValue(), getAttributes());
53     }
54
55     protected static final class ImmutableUnkeyedListEntryNode
56             extends AbstractImmutableDataContainerAttrNode<NodeIdentifier> implements UnkeyedListEntryNode {
57
58         ImmutableUnkeyedListEntryNode(final NodeIdentifier nodeIdentifier,
59                 final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> children,
60                 final Map<QName, String> attributes) {
61             super(children, nodeIdentifier, attributes);
62         }
63     }
64 }