Reuse writer field from parent 68/78068/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 22 Nov 2018 21:13:46 +0000 (22:13 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 22 Nov 2018 23:08:59 +0000 (23:08 +0000)
Writer is a duplicate field, which is already available as
getParent(). Remove the field and use the getter.

Change-Id: I1d5dd866512479268e32affb0ded301fadb5cb11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/SchemaOrderedNormalizedNodeWriter.java

index 9a1b9bd1f09b25b40a97b83a3c97d3e4b935cac2..143b9d4ea857f000f16aeace5d292c74373ec04b 100644 (file)
@@ -38,7 +38,6 @@ public class SchemaOrderedNormalizedNodeWriter extends NormalizedNodeWriter {
     private static final Logger LOG = LoggerFactory.getLogger(SchemaOrderedNormalizedNodeWriter.class);
     private final SchemaContext schemaContext;
     private final SchemaNode root;
-    private final NormalizedNodeStreamWriter writer;
 
     private SchemaNode currentSchemaNode;
 
@@ -55,7 +54,6 @@ public class SchemaOrderedNormalizedNodeWriter extends NormalizedNodeWriter {
     public SchemaOrderedNormalizedNodeWriter(final NormalizedNodeStreamWriter writer, final SchemaContext schemaContext,
             final SchemaPath path) {
         super(writer);
-        this.writer = writer;
         this.schemaContext = schemaContext;
         final Collection<SchemaNode> schemaNodes = SchemaUtils.findParentSchemaNodesOnPath(schemaContext, path);
         Preconditions.checkArgument(!schemaNodes.isEmpty(), "Unable to find schema node for supplied schema path: %s",
@@ -159,7 +157,7 @@ public class SchemaOrderedNormalizedNodeWriter extends NormalizedNodeWriter {
             }
         }
         if (endParent) {
-            writer.endNode();
+            getWriter().endNode();
         }
         return true;
     }