ModelImporter

class ModelImporter(root: INode, continueOnError: Boolean, childFilter: (INode) -> Boolean = { true })

A ModelImporter updates an existing INode and its subtree based on a ModelData specification.

The import is incremental. Instead of simply overwriting the existing model, only a minimal amount of operations is used.

Properties, references, and child links are synchronized for this node and all of its (in-)direct children.

Changes to the behaviour of this class should also reflected in ModelImporter.

Parameters

root

the root node to be updated

continueOnError

if true, ignore exceptions and continue. Enabling this might lead to inconsistent models.

childFilter

filter that is applied to all children of a parent. If the filter evaluates to true, the node is included.

Constructors

Link copied to clipboard
constructor(root: INode)
constructor(root: INode, continueOnError: Boolean, childFilter: (INode) -> Boolean = { true })

Functions

Link copied to clipboard
@JvmName(name = "importData")
fun import(data: ModelData)

Incrementally updates this importers root based on the provided ModelData specification.

Link copied to clipboard
@JvmName(name = "importFile")
fun ModelImporter.import(jsonFile: File)

Incrementally updates the root of the receiver ModelImporter based on the ModelData specification contained in the given file.

Link copied to clipboard
fun importIntoNodes(nodeCombinationsToImport: Sequence<ExistingAndExpectedNode>)

Incrementally updates existing children of the given with specified data.