Syntax

	new(`my.module:MyType`)
new(`my.module:MyType`, $context)

Description

Creates a new object of the specified type. As an optional context, another object can be specified in whose logical context the new object will be created. This context object is available when calculating default values of attributes of the newly created object.

Typically, the object in whose composition reference the newly created object will be stored should be passed as the context. When creating a tree structure, the parent node has a composition reference "children", in which a newly created child node will be stored after creation. So when creating the child node, the parent node should be given as a context object.

Parameters

Name Type Description Mandatory Default
type-literal String Literal of the object type from which a new object is to be created. yes
context Object The object in whose context the creation takes place. Can be used for standard value calculations for attributes. no null

Return value

Type: Subject object

The newly created object of type my.module:MyType.

Examples

	new(`my.module:MyClass`)

Output: Creates an object of the type my.module:MyClass.