Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ChangeMapImpl

Implementation of the change map

inheritdoc

Hierarchy

  • ChangeMapImpl

Implements

Index

Constructors

constructor

  • Create a ChangeMapImpl

    Parameters

    Returns ChangeMapImpl

Properties

Private entries

entries: Array<object> = []

The array of key-value pairs contained in the change map

length

length: number

The number of entries in the change map

Private parts

The JSON pointers contained in the change

Methods

containsKey

  • containsKey(key: string): any
  • Determines if this change map contains an entry for a given JSON Pointer

    throws

    an error if pointer is an invalid JSON Pointer expression

    Parameters

    • key: string

    Returns any

    true if an entry exists, false if not

descendants

  • Returns a view of the portion of this map whose keys are descendants of pointer. If pointer is contained in this map, it will be included in the result.

    throws

    an error if pointer is an invalid JSON Pointer expression

    Parameters

    • pointer: string

    Returns ChangeMapImpl

    changemap of descendant changes

entrySet

  • entrySet(): object[]
  • Returns an array of map entries. Each entry is in the form of a key/value object pair.

    The key is a JSON Pointer expression, in string form. The value will be parsed from the underlying JSON object.

    Returns object[]

    the entry array

    Example:

    changeMap.entrySet().forEach(function(entry) {
        console.log(entry.key, entry.value);
    });

get

  • get(key: string): any
  • Retrieve a value from this change map, identified by a JSON Pointer.

    throws

    an error if pointer is an invalid JSON Pointer expression

    Parameters

    • key: string

    Returns any

    the change map value, if it exists, otherwise null

intersection

  • Returns a view of the portion of this map whose keys are descendants or parents of pointer. If pointer is contained in this map, it will be included in the result.

    This method can be used to determine whether a structural delta affects a particular part of a JSON value. For example:

    if (structuralDelta.removed().intersection("/contact/address").length) {
      // The structural delta removes elements that affect '/contact/address'.
    }
    if (structuralDelta.inserted().intersection("/contact/address").length) {
      // The structural delta inserts elements that affect '/contact/address'.
    }
    throws

    an error if pointer is an invalid JSON Pointer expression

    Parameters

    • pointer: string

    Returns ChangeMapImpl

    changemap of intersection changes