BUG-1275: teach NormalizedNode builders about size hints
[yangtools.git] / yang / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / builder / impl / ImmutableChoiceNodeBuilder.java
index 8375fae86ca4aa18ce70dd0328d2b515d50371c5..f94abe84a6911f5a03dd7901c4ecdbcf0a836582 100644 (file)
@@ -21,6 +21,10 @@ public class ImmutableChoiceNodeBuilder extends AbstractImmutableDataContainerNo
         super();
     }
 
+    protected ImmutableChoiceNodeBuilder(final int sizeHint) {
+        super(sizeHint);
+    }
+
     protected ImmutableChoiceNodeBuilder(final ImmutableChoiceNode node) {
         super(node);
     }
@@ -29,6 +33,10 @@ public class ImmutableChoiceNodeBuilder extends AbstractImmutableDataContainerNo
         return new ImmutableChoiceNodeBuilder();
     }
 
+    public static DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> create(final int sizeHint) {
+        return new ImmutableChoiceNodeBuilder(sizeHint);
+    }
+
     public static DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> create(final ChoiceNode node) {
         if (!(node instanceof ImmutableChoiceNode)) {
             throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
@@ -42,12 +50,10 @@ public class ImmutableChoiceNodeBuilder extends AbstractImmutableDataContainerNo
         return new ImmutableChoiceNode(getNodeIdentifier(), buildValue());
     }
 
-    private static final class ImmutableChoiceNode
-            extends AbstractImmutableDataContainerNode<YangInstanceIdentifier.NodeIdentifier>
-            implements ChoiceNode {
+    private static final class ImmutableChoiceNode extends AbstractImmutableDataContainerNode<YangInstanceIdentifier.NodeIdentifier> implements ChoiceNode {
 
         ImmutableChoiceNode(final YangInstanceIdentifier.NodeIdentifier nodeIdentifier,
-                            final Map<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> children) {
+                final Map<YangInstanceIdentifier.PathArgument, DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> children) {
             super(children, nodeIdentifier);
         }
     }