com.github.fge.jsonpatch.operation
Class CopyOperation
java.lang.Object
com.github.fge.jsonpatch.operation.DualPathOperation
com.github.fge.jsonpatch.operation.CopyOperation
- All Implemented Interfaces:
- JsonSerializable, JsonPatchOperation
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.
OPERATION_NAME
public static final String OPERATION_NAME
- See Also:
- Constant Field Values
CopyOperation
public CopyOperation(JsonPointer from,
JsonPointer path)
apply
public JsonNode apply(JsonNode node)
throws JsonPatchException
- Description copied from interface:
JsonPatchOperation
- Apply this operation to a JSON value
- Parameters:
node
- the value to patch
- Returns:
- the patched value
- Throws:
JsonPatchException
- operation failed to apply to this value