Package dev.drtheo.autojson.adapter
Interface JsonAdapter<From,To>
- Type Parameters:
From- the type to serialize from or deserialize to (e.g.Object).To- the type to serialize to or deserialize from.
- All Superinterfaces:
JsonContext,SchemaHolder
- All Known Implementing Classes:
JsonStringAdapter
The adapter class that allows to (de)serialize elements.
-
Method Summary
Methods inherited from interface dev.drtheo.autojson.adapter.JsonContext
auto, schema, schemaHolder
-
Method Details
-
toJson
- Parameters:
obj- the object to serialize.- Returns:
- the serialized object.
-
toJson
- Type Parameters:
T- the type of the object to serialize.- Parameters:
obj- the object to serialize.type- the type to serialize via.- Returns:
- the serialized object.
-
fromJson
- Type Parameters:
R- the type to deserialize to.- Parameters:
object- the object to deserialize.clazz- the type to deserialize via.- Returns:
- The deserialized object.
- Implementation Note:
- Equivalent to
fromJson(Object, Type).
-
fromJson
- Type Parameters:
R- the type to deserialize to.- Parameters:
object- the object to deserialize.type- the type to deserialize via.- Returns:
- The deserialized object.
-