Package org.glassfish.json
Class JsonMergePatchImpl
- java.lang.Object
-
- org.glassfish.json.JsonMergePatchImpl
-
- All Implemented Interfaces:
JsonMergePatch
public final class JsonMergePatchImpl extends java.lang.Object implements JsonMergePatch
This class is an implementation of a JSON Merge Patch as specified in RFC 7396.- Since:
- 1.1
-
-
Constructor Summary
Constructors Constructor Description JsonMergePatchImpl(JsonValue patch)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonValueapply(JsonValue target)Applies the JSON Merge Patch to the specifiedtarget.(package private) static JsonValuediff(JsonValue source, JsonValue target)Generate a JSON Merge Patch from the source and targetJsonValue.private static JsonValuemergePatch(JsonValue target, JsonValue patch)Applies the specified patch to the specified target.JsonValuetoJsonValue()Returns theJsonMergePatchasJsonValue.
-
-
-
Field Detail
-
patch
private JsonValue patch
-
-
Constructor Detail
-
JsonMergePatchImpl
public JsonMergePatchImpl(JsonValue patch)
-
-
Method Detail
-
apply
public JsonValue apply(JsonValue target)
Description copied from interface:JsonMergePatchApplies the JSON Merge Patch to the specifiedtarget. The target is not modified by the patch.- Specified by:
applyin interfaceJsonMergePatch- Parameters:
target- the target to apply the merge patch- Returns:
- the transformed target after the patch
-
toJsonValue
public JsonValue toJsonValue()
Description copied from interface:JsonMergePatchReturns theJsonMergePatchasJsonValue.- Specified by:
toJsonValuein interfaceJsonMergePatch- Returns:
- this
JsonMergePatchasJsonValue
-
mergePatch
private static JsonValue mergePatch(JsonValue target, JsonValue patch)
Applies the specified patch to the specified target. The target is not modified by the patch.- Parameters:
target- theJsonValueto apply the patch operationspatch- the patch- Returns:
- the
JsonValueas the result of applying the patch operations on the target.
-
-