Class: PropertiesContainer

x2node-records~ PropertiesContainer

Descriptor of an entity that has properties, such as record type or a nested object property.

new PropertiesContainer(recordTypeName, nestedPath, containerDef, parentContainer, defaultModifiable)

Note: The constructor is not accessible from the client code. Container instances are created internally and are made available via other descriptor objects.
Parameters:
Name Type Argument Description
recordTypeName string | Symbol Name of the record type, to which the container belongs (name of the record type if the container is itself the record type).
nestedPath string Dot-separated path to the property represented by the container ending with a dot, or empty string if the container is the record type descriptor.
containerDef Object Container definition.
parentContainer module:x2node-records~PropertiesContainer <nullable>
Parent container, or null if record type.
defaultModifiable boolean Tells if properties are assumed to be modifiable by default or not.

Members


<readonly> allPropertyNames :Array.<string>

Names of all properties in the container.
Type:
  • Array.<string>

<readonly> definition :Object

Container definition (nested object or record type).
Type:
  • Object

<readonly> idPropertyName :string

Name of the id property in the container, or undefined if no id property.
Type:
  • string

<readonly> nestedPath :string

Dot-separated path to the property represented by the container within the record type ending with a dot, or empty string if the container is a record type. Path to a property of a polymoprhic nested object includes the subtype name as a path element.
Type:
  • string

<readonly, nullable> parentContainer :module:x2node-records~PropertiesContainer

Parent container for a nested object property or null for a record type.
Type:

<readonly> recordTypeName :string|Symbol

Name of the record type, to which the container belongs (name of the record type itself if the container is a record type).
Type:
  • string | Symbol

<readonly> subtypes :Array.<string>

For a polymorphic object container, the list of all subtype names. For a polymoprhic reference container, the list of names of all allowed referred record types.
Type:
  • Array.<string>

<readonly> typePropertyName :string

For a polymoprhic object container, name of the property used in the record instances described by the container to indicate the record instance subtype. Note, that the property does not have a descriptor in the container and is not listed in the allPropertyNames.
Type:
  • string

Methods


getPropertyDesc(propName)

Get specified property descriptor.
Parameters:
Name Type Description
propName string Property name.
Throws:
If no such property in the container.
Type
module:x2node-common.X2UsageError
Returns:
The property descriptor.
Type
module:x2node-records~PropertyDescriptor

hasProperty(propName)

Tell if the container contains the specified property.
Parameters:
Name Type Description
propName string Property name.
Returns:
true if there is such property.
Type
boolean

isPolymorph()

Tell if polymorphic object or reference container.
Returns:
true if polymorphic container.
Type
boolean

isPolymorphObject()

Tell if polymorphic object container. A polymorphic object container will have subtypes and typePropertyName descriptor properties. Plus some of the property descriptors in the container will have their isSubtype() method return true.
Returns:
true if polymorphic object container.
Type
boolean

isPolymorphRef()

Tell if polymorphic reference container. A polymorphic reference container will have subtypes descriptor property. Plus all of the property descriptors in the container will have their isSubtype() method return true.
Returns:
true if polymorphic reference container.
Type
boolean

isRecordType()

Tell if this container is a record type descriptor.
Returns:
true if record type descriptor.
Type
boolean