com.github.fge.jsonpatch.operation
Class ReplaceOperation

java.lang.Object
  extended by com.github.fge.jsonpatch.operation.PathValueOperation
      extended by com.github.fge.jsonpatch.operation.ReplaceOperation
All Implemented Interfaces:
JsonSerializable, JsonPatchOperation

public final class ReplaceOperation
extends PathValueOperation

JSON Patch replace operation

For this operation, path points to the value to replace, and value is the replacement value.

It is an error condition if path does not point to an actual JSON value.


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

Field Detail

OPERATION_NAME

public static final String OPERATION_NAME
See Also:
Constant Field Values
Constructor Detail

ReplaceOperation

public ReplaceOperation(JsonPointer path,
                        JsonNode value)
Method Detail

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