public class DomainObjectReader extends Object
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.| Constructor and Description |
|---|
DomainObjectReader(PersistentEntities entities,
Associations associationLinks) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
merge(com.fasterxml.jackson.databind.node.ObjectNode source,
T target,
com.fasterxml.jackson.databind.ObjectMapper mapper) |
<T> T |
read(InputStream source,
T target,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Reads the given input stream into an
ObjectNode and applies that to the given existing instance. |
<T> T |
readPut(com.fasterxml.jackson.databind.node.ObjectNode source,
T target,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Reads the given source node onto the given target object and applies PUT semantics, i.e. explicitly
|
public DomainObjectReader(@NonNull
PersistentEntities entities,
@NonNull
Associations associationLinks)
public <T> T read(InputStream source, T target, com.fasterxml.jackson.databind.ObjectMapper mapper)
ObjectNode and applies that to the given existing instance.source - must not be null.target - must not be null.mapper - must not be null.public <T> T readPut(com.fasterxml.jackson.databind.node.ObjectNode source,
T target,
com.fasterxml.jackson.databind.ObjectMapper mapper)
source - must not be null.target - must not be null.mapper - public <T> T merge(com.fasterxml.jackson.databind.node.ObjectNode source,
T target,
com.fasterxml.jackson.databind.ObjectMapper mapper)
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.