Interface Json.JsonCodec

  • All Implemented Interfaces:

    
    public interface Json.JsonCodec
    
                        

    The abstract JSON codec interface.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract String toJson(Object o) Convert the given object to JSON.
      abstract <T> T fromJson(String json, Class<T> type) Convert the given JSON string to an object of the given class.
      abstract <T> T fromJson(String json, Type type) Convert the given JSON string to an object of the given type.
      abstract InputStream toInputStream(Object o, Class<out Object> type) Convert the given object to an InputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • toJson

         abstract String toJson(Object o)

        Convert the given object to JSON.

        Parameters:
        o - the object to convert.
        Returns:

        the JSON string.

      • fromJson

         abstract <T> T fromJson(String json, Class<T> type)

        Convert the given JSON string to an object of the given class.

        Parameters:
        json - the JSON string.
        type - the class of the object.
        Returns:

        the object.

      • fromJson

         abstract <T> T fromJson(String json, Type type)

        Convert the given JSON string to an object of the given type.

        Parameters:
        json - the JSON string.
        type - the type of the object.
        Returns:

        the object.