Rename OrderedNodeContainer.getChild(int)
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / builder / impl / ImmutableChoiceNodeBuilder.java
index 160e7f80b6742eec4ac76d4d8a02515310688e74..333eec5a87f9a62763c3d82a31942c6846d87abb 100644 (file)
@@ -8,17 +8,17 @@
 package org.opendaylight.yangtools.yang.data.impl.schema.builder.impl;
 
 import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerNode;
 
 public class ImmutableChoiceNodeBuilder extends AbstractImmutableDataContainerNodeBuilder<NodeIdentifier, ChoiceNode> {
 
     protected ImmutableChoiceNodeBuilder() {
-        super();
+
     }
 
     protected ImmutableChoiceNodeBuilder(final int sizeHint) {
@@ -29,15 +29,15 @@ public class ImmutableChoiceNodeBuilder extends AbstractImmutableDataContainerNo
         super(node);
     }
 
-    public static DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> create() {
+    public static @NonNull DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> create() {
         return new ImmutableChoiceNodeBuilder();
     }
 
-    public static DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> create(final int sizeHint) {
+    public static @NonNull DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> create(final int sizeHint) {
         return new ImmutableChoiceNodeBuilder(sizeHint);
     }
 
-    public static DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> create(final ChoiceNode node) {
+    public static @NonNull DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> create(final ChoiceNode node) {
         if (!(node instanceof ImmutableChoiceNode)) {
             throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
         }
@@ -50,11 +50,15 @@ public class ImmutableChoiceNodeBuilder extends AbstractImmutableDataContainerNo
         return new ImmutableChoiceNode(getNodeIdentifier(), buildValue());
     }
 
-    private static final class ImmutableChoiceNode extends AbstractImmutableDataContainerNode<NodeIdentifier> implements ChoiceNode {
-
-        ImmutableChoiceNode(final NodeIdentifier nodeIdentifier,
-                final Map<PathArgument, DataContainerChild<? extends PathArgument, ?>> children) {
+    private static final class ImmutableChoiceNode
+            extends AbstractImmutableDataContainerNode<NodeIdentifier, ChoiceNode> implements ChoiceNode {
+        ImmutableChoiceNode(final NodeIdentifier nodeIdentifier, final Map<PathArgument, Object> children) {
             super(children, nodeIdentifier);
         }
+
+        @Override
+        protected Class<ChoiceNode> implementedType() {
+            return ChoiceNode.class;
+        }
     }
 }