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 Type
    Method
    Description
    default T
    Deprecated.
    Use parseValue(String) instead.
    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

      void writeValue(com.google.gson.stream.JsonWriter ctx, T value) throws IOException
      Serialize specified value with specified JsonWriter..
      Specified by:
      writeValue in interface TypeAwareCodec<T,Object,com.google.gson.stream.JsonWriter>
      Parameters:
      ctx - Write context
      value - Value in native format
      Throws:
      IOException - if the write fails
    • parseValue

      @Deprecated default T parseValue(Object ctx, String str)
      Deprecated.
      Use parseValue(String) instead.
      Parse a String representation into its native format..
      Specified by:
      parseValue in interface TypeAwareCodec<T,Object,com.google.gson.stream.JsonWriter>
      Parameters:
      ctx - Parse context
      str - String representation
      Returns:
      Value in native format
    • parseValue

      T parseValue(String str)
      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