Add JSONValue and JSONCodec.unparseValue()
[yangtools.git] / codec / yang-data-codec-gson / src / main / java / org / opendaylight / yangtools / yang / data / codec / gson / JSONCodec.java
index 908709d88fa3bc9f57ed15a4ca13c01216f009e7..d872cced6eb21ffb7166f279b6f19dd0566123d5 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import com.google.gson.stream.JsonWriter;
 import java.io.IOException;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.util.codec.TypeAwareCodec;
 
 /**
@@ -60,4 +61,13 @@ public sealed interface JSONCodec<T> extends TypeAwareCodec<T, Object, JsonWrite
      * @throws IllegalArgumentException if the value does not parse or pass type validation
      */
     T parseValue(String str);
+
+    /**
+     * Return the {@link JSONValue} representation of a native value.
+     *
+     * @param value Value in native format
+     * @return A {@link JSONValue}
+     * @throws IllegalArgumentException if the value does not parse or pass type validation
+     */
+    @NonNull JSONValue unparseValue(T value);
 }
\ No newline at end of file