package org.opendaylight.yangtools.yang.data.util;
import java.io.IOException;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.SchemaAwareNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.rfc7952.data.api.StreamWriterMetadataExtension;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-public class LeafListNodeDataWithSchema extends CompositeNodeDataWithSchema {
- public LeafListNodeDataWithSchema(final DataSchemaNode schema) {
+/**
+ * Utility class used for tracking parser state as needed by a StAX-like parser.
+ * This class is to be used only by respective XML and JSON parsers in yang-data-codec-xml and yang-data-codec-gson.
+ *
+ * <p>
+ * Represents a YANG leaf-list node.
+ */
+public class LeafListNodeDataWithSchema extends CompositeNodeDataWithSchema<LeafListSchemaNode> {
+ public LeafListNodeDataWithSchema(final LeafListSchemaNode schema) {
super(schema);
}
@Override
- public void write(final SchemaAwareNormalizedNodeStreamWriter writer) throws IOException {
- final LeafListSchemaNode schema = (LeafListSchemaNode) getSchema();
+ public void write(final NormalizedNodeStreamWriter writer, final StreamWriterMetadataExtension metaWriter)
+ throws IOException {
+ final LeafListSchemaNode schema = getSchema();
writer.nextDataSchemaNode(schema);
if (schema.isUserOrdered()) {
writer.startOrderedLeafSet(provideNodeIdentifier(), childSizeHint());
} else {
writer.startLeafSet(provideNodeIdentifier(), childSizeHint());
}
- super.write(writer);
+ super.write(writer, metaWriter);
writer.endNode();
}
}