Merge "Bug 1817 - Add in ietf-restonf to the yangtools-models feature."
[yangtools.git] / yang / yang-data-codec-gson / src / main / java / org / opendaylight / yangtools / yang / data / codec / gson / ChoiceNodeDataWithSchema.java
index 39c1589053ae594692b5bcd16e65b1a27d3a6829..6f840bb3d67ab96ee89829b69a9eadd7f247c66e 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.yangtools.yang.data.codec.gson;
 
-import static org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter.UNKNOWN_SIZE;
-
 import java.io.IOException;
 
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
@@ -30,7 +28,7 @@ class ChoiceNodeDataWithSchema extends CompositeNodeDataWithSchema {
     }
 
     @Override
-    public CompositeNodeDataWithSchema addCompositeChild(final DataSchemaNode schema) {
+    protected CompositeNodeDataWithSchema addCompositeChild(final DataSchemaNode schema) {
         CaseNodeDataWithSchema newChild = new CaseNodeDataWithSchema((ChoiceCaseNode) schema);
         caseNodeDataWithSchema = newChild;
         addCompositeChild(newChild);
@@ -42,10 +40,10 @@ class ChoiceNodeDataWithSchema extends CompositeNodeDataWithSchema {
     }
 
     @Override
-    protected void writeToStream(final NormalizedNodeStreamWriter nnStreamWriter) throws IOException {
-        nnStreamWriter.startChoiceNode(provideNodeIdentifier(), UNKNOWN_SIZE);
-        super.writeToStream(nnStreamWriter);
-        nnStreamWriter.endNode();
+    public void write(final NormalizedNodeStreamWriter writer) throws IOException {
+        writer.startChoiceNode(provideNodeIdentifier(), childSizeHint());
+        super.write(writer);
+        writer.endNode();
     }
 
 }