Package javax.json
Interface JsonMergePatch
-
public interface JsonMergePatch
This interface represents an implementation of a JSON Merge Patch as defined by RFC 7396.
This is a near-exact copy of the same-titled Java EE 8 Class:javax.json.JsonMergePatch
Commenting has been slightly modified to accompany HiLiting the Code Examples.
Java Source Code remains identical to the Sun-Oracle & 'GlassFish' Released Distributions.
Read included License:HERE
, and theCDDL+GPL-1.1
Alljavax.json.*
Code Obtained From:GitHub JavaEE jsonp
Public Archive.
AJsonMergePatch
can 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 twoJsonValue
s.
The following illustrates both approaches.
1. Construct a JsonMergePatch with an existing JSON Merge Patch.
JsonValue contacts = ... ; // The target to be patched JsonValue patch = ... ; // JSON Merge Patch JsonMergePatch mergePatch = Json.createMergePatch(patch); JsonValue result = mergePatch.apply(contacts);
2. Construct a JsonMergePatch from a difference between twoJsonValue
s.
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
Hi-Lited Source-Code:This File's Source Code:
- View Here: javax/json/JsonMergePatch.java
- Open New Browser-Tab: javax/json/JsonMergePatch.java
File Size: 4,013 Bytes Line Count: 96 '\n' Characters Found
Glass Fish Implementation Class:
- View Here: org/glassfish/json/JsonMergePatchImpl.java
- Open New Browser-Tab: org/glassfish/json/JsonMergePatchImpl.java
File Size: 5,295 Bytes Line Count: 142 '\n' Characters Found
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonValue
apply(JsonValue target)
Applies the JSON Merge Patch to the specifiedtarget
.JsonValue
toJsonValue()
Returns theJsonMergePatch
asJsonValue
.
-
-
-
Method Detail
-
apply
-
toJsonValue
JsonValue toJsonValue()
Returns theJsonMergePatch
asJsonValue
.- Returns:
- this
JsonMergePatch
asJsonValue
-
-