Class JsonStringAdapter

java.lang.Object
dev.drtheo.autojson.adapter.string.JsonStringAdapter
All Implemented Interfaces:
JsonAdapter<Object,String>, JsonContext, SchemaHolder

public class JsonStringAdapter extends Object implements JsonAdapter<Object,String>
  • Field Details

  • Constructor Details

    • JsonStringAdapter

      public JsonStringAdapter(AutoJSON auto)
  • Method Details

    • toJson

      public <T> String toJson(T obj, Type type)
      Specified by:
      toJson in interface JsonAdapter<Object,String>
      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.
    • toJson

      protected <T> void toJson(JsonStringBuilder ctx, T obj, Type type, Schema<T> s)
    • fromJson

      public <R> R fromJson(String object, Type clazz)
      Specified by:
      fromJson in interface JsonAdapter<Object,String>
      Type Parameters:
      R - the type to deserialize to.
      Parameters:
      object - the object to deserialize.
      clazz - the type to deserialize via.
      Returns:
      The deserialized object.
    • auto

      public AutoJSON auto()
      Specified by:
      auto in interface JsonContext
      Returns:
      The AutoJSON instance used by the context.