Interface JsonMapping

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      <T> T read​(byte[] bytes, java.lang.Class<T> targetType)
      Reads JSON data from the bytes and creates mapped object of type targetType.
      <T> T read​(byte[] bytes, java.lang.reflect.Type targetType)
      Reads JSON data from the bytes and creates mapped object of type targetType.
      <T> T read​(java.io.InputStream in, java.lang.Class<T> targetType)
      Reads JSON data from the in and creates mapped object of type targetType.
      <T> T read​(java.io.InputStream in, java.lang.reflect.Type targetType)
      Reads JSON data from the in and creates mapped object of type targetType.
      default void write​(java.lang.Object o, java.io.OutputStream os)
      Writes JSON representation of o object to os stream.
    • Method Detail

      • read

        <T> T read​(java.io.InputStream in,
                   java.lang.Class<T> targetType)
            throws java.io.IOException
        Reads JSON data from the in and creates mapped object of type targetType. Note that in might not be closed by the underlying implementation and caller should try to close in.
        Type Parameters:
        T - The type of object to create.
        Parameters:
        in - The input source.
        targetType - The required type.
        Returns:
        The object created from JSON.
        Throws:
        java.io.IOException - When there is a JSON parsing or binding error or I/O error occurred.
      • read

        <T> T read​(java.io.InputStream in,
                   java.lang.reflect.Type targetType)
            throws java.io.IOException
        Reads JSON data from the in and creates mapped object of type targetType. Note that in might not be closed by the underlying implementation and caller should try to close in.
        Type Parameters:
        T - The type of object to create.
        Parameters:
        in - The input source.
        targetType - The required type.
        Returns:
        The object created from JSON.
        Throws:
        java.io.IOException - When there is a JSON parsing or binding error or I/O error occurred.
      • read

        <T> T read​(byte[] bytes,
                   java.lang.Class<T> targetType)
            throws java.io.IOException
        Reads JSON data from the bytes and creates mapped object of type targetType.
        Type Parameters:
        T - The type of object to create.
        Parameters:
        bytes - The input source.
        targetType - The required type.
        Returns:
        The object created from JSON.
        Throws:
        java.io.IOException - When there is a JSON parsing or binding error or I/O error occurred.
      • read

        <T> T read​(byte[] bytes,
                   java.lang.reflect.Type targetType)
            throws java.io.IOException
        Reads JSON data from the bytes and creates mapped object of type targetType.
        Type Parameters:
        T - The type of object to create.
        Parameters:
        bytes - The input source.
        targetType - The required type.
        Returns:
        The object created from JSON.
        Throws:
        java.io.IOException - When there is a JSON parsing or binding error or I/O error occurred.
      • write

        default void write​(java.lang.Object o,
                           java.io.OutputStream os)
                    throws java.io.IOException
        Writes JSON representation of o object to os stream.
        Parameters:
        o - The object to write.
        os - The output stream.
        Throws:
        java.io.IOException - When I/O error occurred.