Merge "Bug 2818: Introduced optional array for parsing root list items."
[yangtools.git] / yang / yang-data-codec-gson / src / main / java / org / opendaylight / yangtools / yang / data / codec / gson / JSONStreamWriterListContext.java
index ed7bd092c952c3e00552a6ab2aa5b7875f4673a9..e1505c7b10898d097b75783314b6f8f136c8ec92 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import com.google.common.base.Preconditions;
+import com.google.gson.stream.JsonWriter;
 import java.io.IOException;
-import java.io.Writer;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -23,13 +23,13 @@ final class JSONStreamWriterListContext extends JSONStreamWriterQNameContext {
     }
 
     @Override
-    protected void emitStart(final SchemaContext schema, final Writer writer) throws IOException {
-        writeJsonIdentifier(schema, writer, getQName());
-        writer.append('[');
+    protected void emitStart(final SchemaContext schema, final JsonWriter writer) throws IOException {
+        writeMyJsonIdentifier(schema, writer, getQName());
+        writer.beginArray();
     }
 
     @Override
-    protected void emitEnd(final Writer writer) throws IOException {
-        writer.append(']');
+    protected void emitEnd(final JsonWriter writer) throws IOException {
+        writer.endArray();
     }
 }