Class CopyOperation

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.JsonSerializable, JsonPatchOperation

    public 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.

    • Constructor Detail

      • CopyOperation

        public CopyOperation​(com.github.fge.jackson.jsonpointer.JsonPointer from,
                             com.github.fge.jackson.jsonpointer.JsonPointer path)
    • Method Detail

      • apply

        public com.fasterxml.jackson.databind.JsonNode apply​(com.fasterxml.jackson.databind.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