Class JacksonCodec

java.lang.Object
org.astonbitecode.j4rs.json.JacksonCodec
All Implemented Interfaces:
Codec

public class JacksonCodec extends Object implements Codec
  • Constructor Details

    • JacksonCodec

      public JacksonCodec()
  • Method Details

    • decode

      public <T> T decode(String json, String className) throws JsonCodecException
      Description copied from interface: Codec
      Deocde a json String to an Object
      Specified by:
      decode in interface Codec
      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

      public String encode(Object obj) throws JsonCodecException
      Description copied from interface: Codec
      Encode an object to json String
      Specified by:
      encode in interface Codec
      Parameters:
      obj - The Object to encode
      Returns:
      A json String
      Throws:
      JsonCodecException - In case something goes wrong
    • decodeArrayContents

      public Object[] decodeArrayContents(String json) throws JsonCodecException
      Description copied from interface: Codec
      Decodes a json String to an array of Objects
      Specified by:
      decodeArrayContents in interface Codec
      Parameters:
      json - The json String to decode
      Returns:
      An array of Objects
      Throws:
      JsonCodecException - In case something goes wrong