Class TestOperation
- java.lang.Object
-
- com.github.fge.jsonpatch.operation.PathValueOperation
-
- com.github.fge.jsonpatch.operation.TestOperation
-
- All Implemented Interfaces:
com.fasterxml.jackson.databind.JsonSerializable,JsonPatchOperation
public class TestOperation extends PathValueOperation
JSON PatchtestoperationThe two arguments for this operation are the pointer containing the value to test (
path) and the value to test equality against (value).It is an error if no value exists at the given path.
Also note that equality as defined by JSON Patch is exactly the same as it is defined by JSON Schema itself. As such, this operation reuses
JsonNumEqualsfor testing equality.
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.google.common.base.Equivalence<com.fasterxml.jackson.databind.JsonNode>EQUIVALENCEstatic StringOPERATION_NAME-
Fields inherited from class com.github.fge.jsonpatch.operation.PathValueOperation
BUNDLE, op, path, value
-
-
Constructor Summary
Constructors Constructor Description TestOperation(com.github.fge.jackson.jsonpointer.JsonPointer path, com.fasterxml.jackson.databind.JsonNode value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.fasterxml.jackson.databind.JsonNodeapply(com.fasterxml.jackson.databind.JsonNode node)Apply this operation to a JSON value-
Methods inherited from class com.github.fge.jsonpatch.operation.PathValueOperation
serialize, serializeWithType, toString
-
-
-
-
Field Detail
-
OPERATION_NAME
public static final String OPERATION_NAME
- See Also:
- Constant Field Values
-
EQUIVALENCE
protected static final com.google.common.base.Equivalence<com.fasterxml.jackson.databind.JsonNode> EQUIVALENCE
-
-
Method Detail
-
apply
public com.fasterxml.jackson.databind.JsonNode apply(com.fasterxml.jackson.databind.JsonNode node) throws JsonPatchExceptionDescription copied from interface:JsonPatchOperationApply 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
-
-