|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.github.fge.jsonpatch.diff.JsonDiff
public final class JsonDiff
"Reverse" factorizing JSON Patch implementation
This class only has one method, asJson(JsonNode, JsonNode), which
takes two JSON values as arguments and returns a patch as a JsonNode.
This generated patch can then be used in JsonPatch.fromJson(JsonNode).
Numeric equivalence is respected. Operations are always generated in the following order:
Array values generate operations in the order of elements. Factorizing is done to merge add and remove into move operations and convert duplicate add to copy operations if values are equivalent. No test operations are generated (they don't really make sense for diffs anyway).
Note that due to the way JsonNode is implemented, this class is
inherently not thread safe (since JsonNode is mutable). It is
therefore the responsibility of the caller to ensure that the calling context
is safe (by ensuring, for instance, that only the diff operation has
references to the values to be diff'ed).
| Method Summary | |
|---|---|
static JsonNode |
asJson(JsonNode source,
JsonNode target)
Generate a JSON patch for transforming the source node into the target node |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static JsonNode asJson(JsonNode source,
JsonNode target)
source - the node to be patchedtarget - the expected result after applying the patch
JsonNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||