BUG-865: integrate SchemaAwareNormalizedNodeStreamWriter 97/39697/8
authorRobert Varga <rovarga@cisco.com>
Wed, 1 Jun 2016 10:42:48 +0000 (12:42 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 6 Jun 2016 11:33:08 +0000 (13:33 +0200)
DataSchemaNodeAware can be cleanly integrated into NormalizedNodeStreamWriter
using default method implementation. Do that, deprecating the wiring.

Once users are removed in downstream projects, these interfaces can be removed.

Change-Id: Icf8d11ba2ee73d6914485f39b0f2c309ff35acc0
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/DataSchemaNodeAware.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/NormalizedNodeStreamWriter.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/schema/stream/SchemaAwareNormalizedNodeStreamWriter.java

index f2108ae0ac4b19e2b82c6cc6b39e3edbf965dedf..8b086c2120ae6d04f378a71d10d2573bcb6f42c0 100644 (file)
@@ -15,7 +15,10 @@ import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
  * Mixin interface for {@link NormalizedNodeStreamWriter} allowing callers to inform the writer of the
  * {@link DataSchemaNode} corresponding to the next node which will either be started or emitted. This interface should
  * not be implemented directly.
+ *
+ * @deprecated This interface has been integrated into {@link NormalizedNodeStreamWriter}.
  */
+@Deprecated
 @Beta
 public interface DataSchemaNodeAware {
     /**
index c0312864dc1536e29e3c57ee7b2c825b6fc9550d..1b1bd097b1988527355cd14dcb1e80ccf3e20682 100644 (file)
@@ -7,13 +7,16 @@
  */
 package org.opendaylight.yangtools.yang.data.api.schema.stream;
 
+import com.google.common.base.Preconditions;
 import java.io.Closeable;
 import java.io.Flushable;
 import java.io.IOException;
+import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 
 
 /**
@@ -74,7 +77,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  * and resources needlessly.
  *
  */
-public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
+public interface NormalizedNodeStreamWriter extends Closeable, Flushable, DataSchemaNodeAware {
 
     /**
      * Methods in this interface allow users to hint the underlying
@@ -472,6 +475,18 @@ public interface NormalizedNodeStreamWriter extends Closeable, Flushable {
      */
     void endNode() throws IOException;
 
+    /**
+     * Attach the specified {@link DataSchemaNode} to the next node which will get started or emitted. The default
+     * implementation does nothing.
+     *
+     * @param schema DataSchemaNode
+     * @throws NullPointerException if the argument is null
+     */
+    @Override
+    default void nextDataSchemaNode(@Nonnull final DataSchemaNode schema) {
+        Preconditions.checkNotNull(schema);
+    }
+
     @Override
     void close() throws IOException;
 
index dbdabcae69a7af95812332699fea8da18c02614b..5ce4336fc40137c1e5d21a3f9ae0133bc0295a5c 100644 (file)
@@ -13,8 +13,11 @@ import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 /**
  * Marker interface for {@link NormalizedNodeStreamWriter}s which can take advantage of {@link DataSchemaNode}
  * information when writing the nodes.
+ *
+ * @deprecated This interface has been integrated into {@link NormalizedNodeStreamWriter}
  */
+@Deprecated
 @Beta
-public interface SchemaAwareNormalizedNodeStreamWriter extends NormalizedNodeStreamWriter, DataSchemaNodeAware {
+public interface SchemaAwareNormalizedNodeStreamWriter extends NormalizedNodeStreamWriter {
 
 }