Package dev.drtheo.autojson.adapter
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.
-
-
Method Summary
Modifier and Type Method Description TotoJson(Object obj)abstract <T> TotoJson(T obj, Type type)<R extends From> RfromJson(To object, Class<R> clazz)abstract <R extends From> RfromJson(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
-
-
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.
-
-
-
-