Package jakarta.json
Interface JsonMergePatch
- 
public interface JsonMergePatchThis interface represents an implementation of a JSON Merge Patch as defined by RFC 7396.
A
The following illustrates both approaches.JsonMergePatchcan be instantiated withJson.createMergePatch(JsonValue)by specifying the patch operations in a JSON Merge Patch or usingJson.createMergeDiff(JsonValue, JsonValue)to create a JSON Merge Patch based on the difference between twoJsonValues.1. Construct a JsonMergePatch with an existing JSON Merge Patch.
2. Construct a JsonMergePatch from a difference between twoJsonValue contacts = ... ; // The target to be patched JsonValue patch = ... ; // JSON Merge Patch JsonMergePatch mergePatch = Json.createMergePatch(patch); JsonValue result = mergePatch.apply(contacts);JsonValues.JsonValue source = ... ; // The source object JsonValue target = ... ; // The modified object JsonMergePatch mergePatch = Json.createMergeDiff(source, target); // The diff between source and target in a Json Merge Patch format- Since:
 - 1.1
 - See Also:
 - RFC 7396
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonValueapply(JsonValue target)Applies the JSON Merge Patch to the specifiedtarget.JsonValuetoJsonValue()Returns theJsonMergePatchasJsonValue. 
 - 
 
- 
- 
Method Detail
- 
apply
JsonValue apply(JsonValue target)
Applies the JSON Merge Patch to the specifiedtarget. The target is not modified by the patch.- Parameters:
 target- the target to apply the merge patch- Returns:
 - the transformed target after the patch
 
 
- 
toJsonValue
JsonValue toJsonValue()
Returns theJsonMergePatchasJsonValue.- Returns:
 - this 
JsonMergePatchasJsonValue 
 
 - 
 
 -