Do not use SchemaPath in yang-data-codec-gson 05/102005/5
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Aug 2022 08:39:00 +0000 (10:39 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 10 Aug 2022 09:21:50 +0000 (09:21 +0000)
SchemaPath is going away, do not reference in GSON-based codec.

JIRA: YANGTOOLS-1244
Change-Id: I1da70a13abda2196e2f453316efd2a9d181d73c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
codec/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java

index 494187ff13119aa9dbe325b9bf559b5841bb1358..86ba2edebf4a4a06dfd9bdd139b3b5eb3d3f2e9a 100644 (file)
@@ -37,7 +37,6 @@ import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.EffectiveStatementInference;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.TypedDataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
 import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
@@ -157,36 +156,6 @@ public abstract class JSONNormalizedNodeStreamWriter implements NormalizedNodeSt
             jsonWriter, new JSONStreamWriterExclusiveRootContext(initialNs));
     }
 
-    /**
-     * Create a new stream writer, which writes to the specified output stream.
-     *
-     * <p>
-     * The codec factory can be reused between multiple writers.
-     *
-     * <p>
-     * Returned writer is exclusive user of JsonWriter, which means it will start
-     * top-level JSON element and ends it.
-     *
-     * <p>
-     * This instance of writer can be used only to emit one top level element,
-     * otherwise it will produce incorrect JSON. Closing this instance will close
-     * the writer too.
-     *
-     * @param codecFactory JSON codec factory
-     * @param path Schema Path
-     * @param initialNs Initial namespace
-     * @param jsonWriter JsonWriter
-     * @return A stream writer instance
-     * @deprecated Use one of the alternative overloads
-     */
-    @Deprecated(since = "9.0.1", forRemoval = true)
-    public static NormalizedNodeStreamWriter createExclusiveWriter(final JSONCodecFactory codecFactory,
-            final SchemaPath path, final XMLNamespace initialNs, final JsonWriter jsonWriter) {
-        return new Exclusive(codecFactory,
-            NormalizedNodeStreamWriterStack.of(codecFactory.getEffectiveModelContext(), path), jsonWriter,
-            new JSONStreamWriterExclusiveRootContext(initialNs));
-    }
-
     /**
      * Create a new stream writer, which writes to the specified output stream.
      *
@@ -288,34 +257,6 @@ public abstract class JSONNormalizedNodeStreamWriter implements NormalizedNodeSt
             jsonWriter, new JSONStreamWriterSharedRootContext(initialNs));
     }
 
-    /**
-     * Create a new stream writer, which writes to the specified output stream.
-     *
-     * <p>
-     * The codec factory can be reused between multiple writers.
-     *
-     * <p>
-     * Returned writer can be used emit multiple top level element,
-     * but does not start / close parent JSON object, which must be done
-     * by user providing {@code jsonWriter} instance in order for
-     * JSON to be valid. Closing this instance <strong>will not</strong>
-     * close the wrapped writer; the caller must take care of that.
-     *
-     * @param codecFactory JSON codec factory
-     * @param path Schema Path
-     * @param initialNs Initial namespace
-     * @param jsonWriter JsonWriter
-     * @return A stream writer instance
-     * @deprecated Use one of the alternative overloads
-     */
-    @Deprecated(since = "9.0.1", forRemoval = true)
-    public static NormalizedNodeStreamWriter createNestedWriter(final JSONCodecFactory codecFactory,
-            final SchemaPath path, final XMLNamespace initialNs, final JsonWriter jsonWriter) {
-        return new Nested(codecFactory,
-            NormalizedNodeStreamWriterStack.of(codecFactory.getEffectiveModelContext(), path), jsonWriter,
-            new JSONStreamWriterSharedRootContext(initialNs));
-    }
-
     /**
      * Create a new stream writer, which writes to the specified output stream.
      *