- java.lang.Object
-
- org.eclipse.parsson.JsonMergePatchImpl
-
- All Implemented Interfaces:
jakarta.json.JsonMergePatch
public final class JsonMergePatchImpl extends java.lang.Object implements jakarta.json.JsonMergePatchThis class is an implementation of a JSON Merge Patch as specified in RFC 7396.- Since:
- 1.1
-
-
Field Summary
Fields Modifier and Type Field Description private JsonContextjsonContextprivate jakarta.json.JsonValuepatch
-
Constructor Summary
Constructors Constructor Description JsonMergePatchImpl(jakarta.json.JsonValue patch, JsonContext jsonContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.json.JsonValueapply(jakarta.json.JsonValue target)(package private) static jakarta.json.JsonValuediff(jakarta.json.JsonValue source, jakarta.json.JsonValue target, JsonContext jsonContext)Generate a JSON Merge Patch from the source and targetJsonValue.booleanequals(java.lang.Object obj)Compares thisJsonMergePatchImplwith another object.inthashCode()Returns the hash code value for thisJsonMergePatchImpl.private jakarta.json.JsonValuemergePatch(jakarta.json.JsonValue target, jakarta.json.JsonValue patch)Applies the specified patch to the specified target.jakarta.json.JsonValuetoJsonValue()java.lang.StringtoString()Returns the JSON Patch text
-
-
-
Field Detail
-
patch
private final jakarta.json.JsonValue patch
-
jsonContext
private final JsonContext jsonContext
-
-
Constructor Detail
-
JsonMergePatchImpl
public JsonMergePatchImpl(jakarta.json.JsonValue patch, JsonContext jsonContext)
-
-
Method Detail
-
apply
public jakarta.json.JsonValue apply(jakarta.json.JsonValue target)
- Specified by:
applyin interfacejakarta.json.JsonMergePatch
-
toJsonValue
public jakarta.json.JsonValue toJsonValue()
- Specified by:
toJsonValuein interfacejakarta.json.JsonMergePatch
-
mergePatch
private jakarta.json.JsonValue mergePatch(jakarta.json.JsonValue target, jakarta.json.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.
-
diff
static jakarta.json.JsonValue diff(jakarta.json.JsonValue source, jakarta.json.JsonValue target, JsonContext jsonContext)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
-
equals
public boolean equals(java.lang.Object obj)
Compares thisJsonMergePatchImplwith another object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare thisJsonMergePatchImplagainst- Returns:
- true if the given object is a
JsonMergePatchImplwith the same reference tokens as this one, false otherwise.
-
hashCode
public int hashCode()
Returns the hash code value for thisJsonMergePatchImpl.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code value for this
JsonMergePatchImplobject
-
toString
public java.lang.String toString()
Returns the JSON Patch text- Overrides:
toStringin classjava.lang.Object- Returns:
- the JSON Patch text
-
-