Package org.eclipse.ditto.json
Class JsonMergePatch
java.lang.Object
org.eclipse.ditto.json.JsonMergePatch
This class is responsible to compute or apply a JSON merge patch according to
RFC 7386 for
json values
.- Since:
- 2.4.0
-
Method Summary
Modifier and TypeMethodDescriptionApplies this merge patch on the given json value.static Optional<JsonMergePatch>
This method computes the change from the givenoldValue
to the givennewValue
.boolean
int
hashCode()
static JsonMergePatch
of
(JsonPointer path, JsonValue mergePatch) static JsonMergePatch
Creates aJsonMergePatch
with an patch object containing the givenmergePatch
at root level.toString()
-
Method Details
-
compute
This method computes the change from the givenoldValue
to the givennewValue
. The result is a JSON merge patch according to RFC 7386.- Parameters:
oldValue
- the original valuenewValue
- the new changed value- Returns:
- a JSON merge patch according to RFC 7386 or empty if values are equal.
-
of
- Parameters:
path
- The path on which the givenmergePatch
should be applied later.mergePatch
- the actual patch.- Returns:
- the merge patch.
-
of
Creates aJsonMergePatch
with an patch object containing the givenmergePatch
at root level.- Parameters:
mergePatch
- the actual patch.- Returns:
- the merge patch.
-
applyOn
Applies this merge patch on the given json value.- Parameters:
jsonValue
- the json value that should be patched.- Returns:
- the patched json value.
-
asJsonValue
- Returns:
- the merge patch json value
-
equals
-
hashCode
public int hashCode() -
toString
-