com.github.fge.jsonpatch
Class CopyOperation

java.lang.Object
  extended by com.github.fge.jsonpatch.JsonPatchOperation
      extended by com.github.fge.jsonpatch.DualPathOperation
          extended by 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:

It is an error if from fails to resolve to a JSON value.


Field Summary
 
Fields inherited from class com.github.fge.jsonpatch.DualPathOperation
from
 
Fields inherited from class com.github.fge.jsonpatch.JsonPatchOperation
BUNDLE, op, path
 
Constructor Summary
CopyOperation(JsonPointer from, JsonPointer path)
           
 
Method Summary
 JsonNode apply(JsonNode node)
          Apply this operation to a JSON value
 
Methods inherited from class com.github.fge.jsonpatch.DualPathOperation
serialize, serializeWithType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CopyOperation

public CopyOperation(JsonPointer from,
                     JsonPointer path)
Method Detail

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