Class TestOperation

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

    public class TestOperation
    extends PathValueOperation
    JSON Patch test operation

    The 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 JsonNumEquals for testing equality.

    • Field Detail

      • EQUIVALENCE

        protected static final com.google.common.base.Equivalence<com.fasterxml.jackson.databind.JsonNode> EQUIVALENCE
    • Constructor Detail

      • TestOperation

        public TestOperation​(com.github.fge.jackson.jsonpointer.JsonPointer path,
                             com.fasterxml.jackson.databind.JsonNode value)
    • 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