Interface JSONCodec<T>
- Type Parameters:
T
- Normalized value type
- All Superinterfaces:
TypeAwareCodec<T,
Object, com.google.gson.stream.JsonWriter>
public sealed interface JSONCodec<T>
extends TypeAwareCodec<T,Object,com.google.gson.stream.JsonWriter>
A codec capable of performing normalized value conversion with a
JsonWriter
.-
Method Summary
Modifier and TypeMethodDescriptiondefault T
parseValue
(Object ctx, String str) Deprecated.parseValue
(String str) Parse a String representation into its native format.@NonNull JSONValue
unparseValue
(T value) Return theJSONValue
representation of a native value.default void
writeValue
(com.google.gson.stream.JsonWriter writer, T value) Deprecated, for removal: This API element is subject to removal in a future version.UsewriteValue(JSONValueWriter, Object)
instead.void
writeValue
(JSONValueWriter ctx, T value) Serialize specified value with specifiedJSONValueWriter
.Methods inherited from interface org.opendaylight.yangtools.yang.data.util.codec.TypeAwareCodec
getDataType
-
Method Details
-
writeValue
@Deprecated(since="13.0.3", forRemoval=true) default void writeValue(com.google.gson.stream.JsonWriter writer, T value) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.UsewriteValue(JSONValueWriter, Object)
instead.Serialize specified value with specified JsonWriter..- Specified by:
writeValue
in interfaceTypeAwareCodec<T,
Object, com.google.gson.stream.JsonWriter> - Parameters:
writer
- Write contextvalue
- Value in native format- Throws:
IOException
- if the write fails
-
writeValue
Serialize specified value with specifiedJSONValueWriter
.- Parameters:
ctx
- Write contextvalue
- Value in native format- Throws:
IOException
- if the write fails
-
parseValue
Deprecated.UseparseValue(String)
instead.Parse a String representation into its native format..- Specified by:
parseValue
in interfaceTypeAwareCodec<T,
Object, com.google.gson.stream.JsonWriter> - Parameters:
ctx
- Parse contextstr
- String representation- Returns:
- Value in native format
-
parseValue
Parse a String representation into its native format.- Parameters:
str
- String representation- Returns:
- Value in native format
- Throws:
IllegalArgumentException
- if the value does not parse or pass type validation
-
unparseValue
Return theJSONValue
representation of a native value.- Parameters:
value
- Value in native format- Returns:
- A
JSONValue
- Throws:
IllegalArgumentException
- if the value does not parse or pass type validation
-
parseValue(String)
instead.