Class DomainObjectReader

java.lang.Object
org.springframework.data.rest.webmvc.json.DomainObjectReader

public class DomainObjectReader extends Object
Component to apply an ObjectNode to an existing domain object. This is effectively a best-effort workaround for Jackson's inability to apply a (partial) JSON document to an existing object in a deeply nested way. We manually detect nested objects, lookup the original value and apply the merge recursively.
Since:
2.2
Author:
Oliver Gierke, Mark Paluch, Craig Andrews, Mathias Düsterhöft, Thomas Mrozinski, Lars Vierbergen
  • Constructor Details

  • Method Details

    • read

      public <T> T read(InputStream source, T target, ObjectMapper mapper)
      Reads the given input stream into an ObjectNode and applies that to the given existing instance.
      Parameters:
      source - must not be null.
      target - must not be null.
      mapper - must not be null.
      Returns:
    • readPut

      public <T> T readPut(ObjectNode source, T target, ObjectMapper mapper) throws Exception
      Reads the given source node onto the given target object and applies PUT semantics, i.e. explicitly
      Parameters:
      source - must not be null.
      target - must not be null.
      mapper -
      Returns:
      Throws:
      Exception