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

public interface JsonAdapter<From,To> extends JsonContext
The adapter class that allows to (de)serialize elements.
  • Method Details

    • toJson

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

      <T> To toJson(T obj, Type type)
      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

      default <R extends From> R fromJson(To object, Class<R> clazz)
      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

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