Class DeltaJSONFactory

Create a new instance of the factory class supporting the JSON patch file format.

FIXME: This class is just a copy-paste + search-replace from DeltaXMLFactory and will most likely not work out of the box.

Constructor

class DeltaJSONFactory()

Methods

createAttacher

DeltaJSONFactory#createAttacher(resolver)
Arguments:
  • resolver (Object) – An instance of ContextResolver. Use the output of createResolver method from the resolver factory.
Returns delta.Attacher:
 

Initialized attacher instance.

Return an initialized context delta attacher instance

createCollector

DeltaJSONFactory#createCollector(deltadoc, doc[, equals])
Arguments:
  • deltadoc (Object) – The delta document produced by createEmptyDocument or loadDocument.
  • doc (Object) – The document as created by the loadOriginalDocument method of the document factory class.
  • equals (functio) – The equality test-function used during diffing.
Returns delta.DeltaCollector:
 

An initialized collector instance.

Return an initialized collector instance.

createDeltaAdapter

DeltaJSONFactory#createDeltaAdapter(fragAdapter)
Arguments:
  • fragAdapter (Object) – A document fragemnt adapter. Use the object produced by createFragmentAdapter method from a document factory.
Returns jsondelta.JSONDeltaAdapter:
 

Initialized instance of the proper delta adapter.

Return an initialized delta adapter instance.

createDetacher

DeltaJSONFactory#createDetacher(doc)
Arguments:
  • doc (Object) – The document as created by the loadOriginalDocument method of the document factory class.
Returns contextdelta.Detacher:
 

Initialized detacher instance.

Return an initialized context delta detacher instance.

createEmptyDocument

DeltaJSONFactory#createEmptyDocument([matching])
Arguments:
  • matching (tree.Matching) – A matching produced by some tree diff algorithm.
Returns Object:

A delta document initialized with default values.

Return a new empty delta document.

loadDocument

DeltaJSONFactory#loadDocument(jsondoc, fragAdapter[, name])
Arguments:
  • jsondoc (String|Document) – A document containing delta operations.
  • fragAdapter (Object) – A document fragemnt adapter. Use the object produced by createFragmentAdapter method from a document factory.
  • name (String) – The file name of the document.
Returns Object:

A delta document initialized with default values.

Return a delta document loaded from the given string or JavaScript object.

serializeDocument

DeltaJSONFactory#serializeDocument(deltadoc)
Arguments:
  • deltadoc (Object) – A populated delta document.
Returns String:

The JSON representation of the delta document as a string.

Serialize the data property into the src string and return it. Also store the source into the src property of deltadoc.