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.void
writeValue
(com.google.gson.stream.JsonWriter ctx, T value) Serialize specified value with specified JsonWriter.Methods inherited from interface org.opendaylight.yangtools.yang.data.util.codec.TypeAwareCodec
getDataType
-
Method Details
-
writeValue
Serialize specified value with specified JsonWriter..- Specified by:
writeValue
in interfaceTypeAwareCodec<T,
Object, com.google.gson.stream.JsonWriter> - 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
-
parseValue(String)
instead.