public static interface JSONDelta.ChangeMap extends Map<String,JSON>
The JSONDelta.inserted()
method returns a
ChangeMap
describing the parts of the second JSON value not found
in the first JSON value. Similarly, JSONDelta.removed()
returns a ChangeMap
describing the parts of the first JSON value
not found in the second JSON value.
The map contains an entry for each change, as follows:
/0
.
JSON
that can be parsed independently as a unit, or
converted to JSON
.
Instances cannot be modified. Destructive methods such as
Map.put(Object, Object)
throw
UnsupportedOperationException
if called.
An IllegalArgumentException
will be thrown if an invalid JSON
pointer expression is passed to Map.get(Object)
,
Map.containsKey(Object)
, descendants(String)
, or
intersection(String)
. This only occurs if the expression does
not start with /
and is not empty.
Modifier and Type | Method and Description |
---|---|
JSONDelta.ChangeMap |
descendants(String pointer)
Returns a view of the portion of this map whose keys are descendants
of
pointer . |
JSONDelta.ChangeMap |
intersection(String pointer)
Returns a view of the portion of this map whose keys are descendants
or parents of
pointer . |
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
JSONDelta.ChangeMap descendants(String pointer)
pointer
. If pointer
is contained in this map, it
will be included in the result.IllegalArgumentException
- if pointer is an invalid JSON
Pointer expressionJSONDelta.ChangeMap intersection(String pointer)
pointer
. If pointer
is contained in
this map, it will be included in the result.
This method can be used to determine whether a structural delta affects a particular part of a JSON value. For example:
if (!structuralDelta.removed().intersection("/contact/address").isEmpty()) { // The structural delta removes elements that affect '/contact/address'. } if (!structuralDelta.inserted().intersection("/contact/address").isEmpty()) { // The structural delta inserts elements that affect '/contact/address'. }
IllegalArgumentException
- if pointer is an invalid JSON
Pointer expressionCopyright © 2022 Push Technology Ltd. All Rights Reserved.