Package org.glassfish.json
Class JsonMergePatchImpl
java.lang.Object
org.glassfish.json.JsonMergePatchImpl
- All Implemented Interfaces:
JsonMergePatch
This class is an implementation of a JSON Merge Patch as specified in
RFC 7396.
- Since:
- 1.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApplies the JSON Merge Patch to the specifiedtarget
.(package private) static JsonValue
Generate a JSON Merge Patch from the source and targetJsonValue
.private static JsonValue
mergePatch
(JsonValue target, JsonValue patch) Applies the specified patch to the specified target.Returns theJsonMergePatch
asJsonValue
.
-
Field Details
-
patch
-
-
Constructor Details
-
JsonMergePatchImpl
-
-
Method Details
-
apply
Description copied from interface:JsonMergePatch
Applies the JSON Merge Patch to the specifiedtarget
. The target is not modified by the patch.- Specified by:
apply
in interfaceJsonMergePatch
- Parameters:
target
- the target to apply the merge patch- Returns:
- the transformed target after the patch
-
toJsonValue
Description copied from interface:JsonMergePatch
Returns theJsonMergePatch
asJsonValue
.- Specified by:
toJsonValue
in interfaceJsonMergePatch
- Returns:
- this
JsonMergePatch
asJsonValue
-
mergePatch
Applies the specified patch to the specified target. The target is not modified by the patch.- Parameters:
target
- theJsonValue
to apply the patch operationspatch
- the patch- Returns:
- the
JsonValue
as the result of applying the patch operations on the target.
-
diff
Generate a JSON Merge Patch from the source and targetJsonValue
.- Parameters:
source
- the sourcetarget
- the target- Returns:
- a JSON Patch which when applied to the source, yields the target
-