Home Manual Reference Source
public class | source

ModelNodeHelper

Static helper methods for dealing with ModelNodes and NamedNodes. Some methods accept a path parameter separated by "/" to get a deeply nested data.

Static Method Summary

Static Public Methods
public static

asNamedNodes(properties: Property[]): NamedNode[]

Turns an properties array into an array of names nodes.

public static

failSafeBoolean(modelNode: ModelNode, path: string): boolean

Tries to get a deeply nested boolean value from the specified model node.

public static

failSafeGet(modelNode: ModelNode, path: string): ModelNode

Tries to get a deeply nested model node from the specified model node.

public static

failSafeList(modelNode: ModelNode, path: string): ModelNode[]

Tries to get a deeply nested node array from the specified model node.

public static

Tries to get a deeply nested property array from the specified model node.

Static Public Methods

public static asNamedNodes(properties: Property[]): NamedNode[] source

Turns an properties array into an array of names nodes.

Params:

NameTypeAttributeDescription
properties Property[]

The properties

Return:

NamedNode[]

the array of named nodes

public static failSafeBoolean(modelNode: ModelNode, path: string): boolean source

Tries to get a deeply nested boolean value from the specified model node. Nested paths must be separated with "/".

Params:

NameTypeAttributeDescription
modelNode ModelNode

The model node to read from

path string

A path separated with "/"

Return:

boolean

the boolean value or false.

public static failSafeGet(modelNode: ModelNode, path: string): ModelNode source

Tries to get a deeply nested model node from the specified model node. Nested paths must be separated with "/".

Params:

NameTypeAttributeDescription
modelNode ModelNode

The model node to read from

path string

A path separated with "/"

Return:

ModelNode

The nested node or an empty / undefined model node

public static failSafeList(modelNode: ModelNode, path: string): ModelNode[] source

Tries to get a deeply nested node array from the specified model node. Nested paths must be separated with "/".

Params:

NameTypeAttributeDescription
modelNode ModelNode

The model node to read from

path string

A path separated with "/"

Return:

ModelNode[]

the model nodes or an empty array

public static failSafePropertyList(modelNode: ModelNode, path: string): Property[] source

Tries to get a deeply nested property array from the specified model node. Nested paths must be separated with "/".

Params:

NameTypeAttributeDescription
modelNode ModelNode

The model node to read from

path string

A path separated with "/"

Return:

Property[]

the properties or an empty array