Interface Codec

All Known Implementing Classes:
JacksonCodec

public interface Codec
Codec to perform JSON encoding and decoding
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    decode(String json, String className)
    Deocde a json String to an Object
    Decodes a json String to an array of Objects
    <T> String
    encode(T obj)
    Encode an object to json String
  • Method Details

    • decode

      <T> T decode(String json, String className) throws JsonCodecException
      Deocde a json String to an Object
      Type Parameters:
      T - The type of the object
      Parameters:
      json - The json
      className - A class name
      Returns:
      An Object
      Throws:
      JsonCodecException - In case something goes wrong
    • encode

      <T> String encode(T obj) throws JsonCodecException
      Encode an object to json String
      Type Parameters:
      T - The type of the Object
      Parameters:
      obj - The Object to encode
      Returns:
      A json String
      Throws:
      JsonCodecException - In case something goes wrong
    • decodeArrayContents

      Object[] decodeArrayContents(String json) throws JsonCodecException
      Decodes a json String to an array of Objects
      Parameters:
      json - The json String to decode
      Returns:
      An array of Objects
      Throws:
      JsonCodecException - In case something goes wrong