Interface JsonDeserializationContext

All Superinterfaces:
JsonContext, SchemaHolder
All Known Implementing Classes:
JsonStringParser

public interface JsonDeserializationContext extends JsonContext
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> T
    decode(Type type)
    Decodes the value in the current context.
    default <T> T
    decode(Type type, Schema<T> schema)
    Decodes the value in the current context.
    <T> T
    Decodes the value in the current context.
    default <T> T
    Decodes a custom value in the current context.
    <T> T
    decodeCustom(Type type, @NotNull Schema<T> schema)
    Decodes the value in the current context.

    Methods inherited from interface dev.drtheo.autojson.adapter.JsonContext

    auto, schema, schemaHolder
  • Method Details

    • decodeBuiltIn

      <T> T decodeBuiltIn()
      Decodes the value in the current context.
      Type Parameters:
      T - the type of the object.
      Returns:
      The decoded built-in object.
      See Also:
      Implementation Note:
      Should only be used for built-in objects!
    • decode

      default <T> T decode(Type type)
      Decodes the value in the current context.
      Type Parameters:
      T - the type of the object.
      Parameters:
      type - the type of the object to decode.
      Returns:
      The decoded object.
      Implementation Note:
      This method prefers the built-in values over PrimitiveSchemas. Consider using decode(Type, Schema) if you want to prioritize the schemas over built-in types.
    • decode

      default <T> T decode(Type type, Schema<T> schema)
      Decodes the value in the current context.
      Type Parameters:
      T - the type of the object.
      Parameters:
      type - the type of the object to decode.
      Returns:
      The decoded object.
      Throws:
      IllegalArgumentException - when the type is non-built-in and the provded schema is null.
    • decodeCustom

      default <T> T decodeCustom(Type type)
      Decodes a custom value in the current context.
      Type Parameters:
      T - the type of the object.
      Parameters:
      type - the type of the object to decode.
      Returns:
      The decoded object.
      Throws:
      NullPointerException - if the schema is null.
      Implementation Note:
      Should only be used for non-built-in objects!
    • decodeCustom

      <T> T decodeCustom(Type type, @NotNull @NotNull Schema<T> schema)
      Decodes the value in the current context.
      Type Parameters:
      T - the type of the object.
      Parameters:
      type - the type of the object to decode.
      schema - the schema used to decode the value.
      Returns:
      The decoded non-built-in object.
      Implementation Note:
      Should only be used for non-built-in objects!