com.github.fge.jsonpatch
Class CopyOperation
java.lang.Object
com.github.fge.jsonpatch.JsonPatchOperation
com.github.fge.jsonpatch.DualPathOperation
com.github.fge.jsonpatch.CopyOperation
- All Implemented Interfaces:
- JsonSerializable
public final class CopyOperation
- extends DualPathOperation
JSON Patch copy operation
For this operation, from is the JSON Pointer of the value to copy,
and path is the destination where the value should be copied.
As for add:
- the value at the destination path is either created or replaced;
- it is created only if the immediate parent exists;
- appends at the end of an array.
It is an error if from fails to resolve to a JSON value.
CopyOperation
public CopyOperation(JsonPointer from,
JsonPointer path)
apply
public JsonNode apply(JsonNode node)
throws JsonPatchException
- Description copied from class:
JsonPatchOperation
- Apply this operation to a JSON value
- Specified by:
apply in class JsonPatchOperation
- Parameters:
node - the value to patch
- Returns:
- the patched value
- Throws:
JsonPatchException - operation failed to apply to this value