Class JsonApiPatchDtoReader

java.lang.Object
com.kazforge.jsonapi.jackson3.JsonApiPatchDtoReader

public final class JsonApiPatchDtoReader extends Object
Reads a validated JSON:API resource-update document directly into an application-owned annotated PATCH DTO.

readValue(java.lang.String, java.lang.Class<T>) decodes and aggregate-validates through a factory-composed DocumentReadContext (PrimaryDataKind.RESOURCE with DocumentUsage.UPDATE_REQUEST), then binds the whole update into the PATCH DTO: patchable attributes and relationships declared as PatchPresence receive omitted(), present(value), or present(null) (explicit JSON null / null relationship linkage), and the identifier binds through IdentifierConverter. fromDocument(com.kazforge.jsonapi.core.model.JsonApiDocument, java.lang.Class<T>) binds without re-validation. Codec and aggregate failures stay JsonApiDocumentReadException; bind failures stay JsonApiMappingException with resource-relative pointers and are never prefixed with /data.

Close/ownership rules match JsonApiDocumentReader: convenience overloads close parsers they create; caller-owned streams and parsers stay open. Construct via JsonApiJackson3.patchDtoReader(JsonMapper) or its overloads. Safe for concurrent use once created.

  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    fromDocument(com.kazforge.jsonapi.core.model.JsonApiDocument document, Class<T> dtoType)
    Binds an already-validated document without re-parsing or re-validating.
    fromDocument(com.kazforge.jsonapi.core.model.JsonApiDocument document, tools.jackson.databind.JavaType dtoType)
    Binds an already-validated document without re-parsing or re-validating, preserving full JavaType parameterization.
    <T> T
    readValue(byte[] utf8Json, Class<T> dtoType)
    Decodes, validates, and binds the UTF-8 JSON:API update document in the given bytes.
    readValue(byte[] utf8Json, tools.jackson.databind.JavaType dtoType)
    Byte-array overload of readValue(String, JavaType).
    <T> T
    readValue(InputStream utf8Stream, Class<T> dtoType)
    Decodes, validates, and binds one JSON:API update document from a caller-owned UTF-8 stream.
    readValue(InputStream utf8Stream, tools.jackson.databind.JavaType dtoType)
    Stream overload of readValue(String, JavaType).
    <T> T
    readValue(String json, Class<T> dtoType)
    Decodes, validates, and binds the JSON:API update document in the given string.
    readValue(String json, tools.jackson.databind.JavaType dtoType)
    Decodes, validates, and binds using a JavaType, preserving full parameterization.
    <T> T
    readValue(tools.jackson.core.JsonParser parser, Class<T> dtoType)
    Decodes, validates, and binds one JSON:API update document from a caller-owned parser.
    readValue(tools.jackson.core.JsonParser parser, tools.jackson.databind.JavaType dtoType)
    Parser overload of readValue(String, JavaType).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • readValue

      public <T> T readValue(String json, Class<T> dtoType)
      Decodes, validates, and binds the JSON:API update document in the given string.
    • readValue

      public <T> T readValue(byte[] utf8Json, Class<T> dtoType)
      Decodes, validates, and binds the UTF-8 JSON:API update document in the given bytes.
    • readValue

      public <T> T readValue(InputStream utf8Stream, Class<T> dtoType)
      Decodes, validates, and binds one JSON:API update document from a caller-owned UTF-8 stream. The stream is not closed.
    • readValue

      public <T> T readValue(tools.jackson.core.JsonParser parser, Class<T> dtoType)
      Decodes, validates, and binds one JSON:API update document from a caller-owned parser. The parser is not closed.
    • readValue

      public Object readValue(String json, tools.jackson.databind.JavaType dtoType)
      Decodes, validates, and binds using a JavaType, preserving full parameterization.
    • readValue

      public Object readValue(byte[] utf8Json, tools.jackson.databind.JavaType dtoType)
      Byte-array overload of readValue(String, JavaType).
    • readValue

      public Object readValue(InputStream utf8Stream, tools.jackson.databind.JavaType dtoType)
      Stream overload of readValue(String, JavaType).
    • readValue

      public Object readValue(tools.jackson.core.JsonParser parser, tools.jackson.databind.JavaType dtoType)
      Parser overload of readValue(String, JavaType).
    • fromDocument

      public <T> T fromDocument(com.kazforge.jsonapi.core.model.JsonApiDocument document, Class<T> dtoType)
      Binds an already-validated document without re-parsing or re-validating. Requires non-null DocumentData.SingleResource primary data; other primary-data states throw IllegalArgumentException.
    • fromDocument

      public Object fromDocument(com.kazforge.jsonapi.core.model.JsonApiDocument document, tools.jackson.databind.JavaType dtoType)
      Binds an already-validated document without re-parsing or re-validating, preserving full JavaType parameterization. Requires non-null DocumentData.SingleResource primary data; other primary-data states throw IllegalArgumentException.