|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.github.fge.jsonpatch.diff.JsonDiff
@ParametersAreNonnullByDefault public final class JsonDiff
JSON "diff" implementation
This class generates a JSON Patch (as in, an RFC 6902 JSON Patch) given
two JSON values as inputs. The patch can be obtained directly as a JsonPatch
or as a JsonNode
.
Note: there is no guarantee about the usability of the generated patch for any other source/target combination than the one used to generate the patch.
This class always performs operations in the following order: removals,
additions and replacements. It then factors removal/addition pairs into
move operations, or copy operations if a common element exists, at the same
pointer
, in both the source and destination.
You can obtain a diff either as a JsonPatch
directly or, for
backwards compatibility, as a JsonNode
.
Method Summary | |
---|---|
static JsonNode |
asJson(JsonNode source,
JsonNode target)
Generate a JSON patch for transforming the source node into the target node |
static JsonPatch |
asJsonPatch(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 JsonPatch asJsonPatch(JsonNode source, JsonNode target)
source
- the node to be patchedtarget
- the expected result after applying the patch
JsonPatch
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 |