Class GeneratePatchDiffService

  • All Implemented Interfaces:
    AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator, Service, StateManagedComponent

    @ComponentProfile(summary="Generate a JSON patch diff between two documents",
                      tag="service,json,jsonpatch",
                      since="3.9.0")
    public class GeneratePatchDiffService
    extends JsonPatchService
    Generate a JSON patch diff between two documents

    JSON Patch defines a JSON document structure for expressing a sequence of operations to apply to a JavaScript Object Notation (JSON) document. This service generates the JSON that expresses the differences between 2 JSON documents as a sequence of operations.

    For a given diff-source of {"a": 0,"b": [1,2]} and a diff-target of {"b": [1,2,0]} then the patch transformation generated and stored against output should be [{"op":"move","from":"/a","path":"/b/2"}].

    Note that zjsonpatch operates on JsonNode objects; this means keeping the both node trees in memory, so behaviour will be size/memory dependent.

    In the adapter configuration file this class is aliased as json-patch-generate-diff which is the preferred alternative to the fully qualified classname when building your configuration.