Interface JsonAdapter

  • All Implemented Interfaces:
    dev.drtheo.autojson.SchemaHolder , dev.drtheo.autojson.adapter.JsonContext

    
    public interface JsonAdapter<From, To>
     implements JsonContext
                        

    The adapter class that allows to (de)serialize elements.

    • 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
      To toJson(Object obj)
      abstract <T> To toJson(T obj, Type type)
      <R extends From> R fromJson(To object, Class<R> clazz)
      abstract <R extends From> R fromJson(To object, Type type)
      • Methods inherited from class dev.drtheo.autojson.adapter.JsonContext

        auto, schema, schemaHolder
      • Methods inherited from class dev.drtheo.autojson.SchemaHolder

        schema
      • Methods inherited from class java.lang.Object

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

    • Method Detail

      • toJson

         To toJson(Object obj)
        Parameters:
        obj - the object to serialize.
        Returns:

        the serialized object.

      • toJson

         abstract <T> To toJson(T obj, Type type)
        Parameters:
        obj - the object to serialize.
        type - the type to serialize via.
        Returns:

        the serialized object.

      • fromJson

         <R extends From> R fromJson(To object, Class<R> clazz)
        Parameters:
        object - the object to deserialize.
        clazz - the type to deserialize via.
        Returns:

        The deserialized object.

      • fromJson

         abstract <R extends From> R fromJson(To object, Type type)
        Parameters:
        object - the object to deserialize.
        type - the type to deserialize via.
        Returns:

        The deserialized object.