Class: RecordTypeDescriptor

x2node-records~ RecordTypeDescriptor

Record type descriptor.

new RecordTypeDescriptor(recordTypeName, recordTypeDef)

Note: The constructor is not accessible from the client code. Record type descriptors are created internally and are available via the record type library's getRecordTypeDesc() method.
Parameters:
Name Type Description
recordTypeName string | Symbol Record type name.
recordTypeDef Object Record type definition.

Extends

Members


<readonly> allPropertyNames :Array.<string>

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

<readonly> definition :Object

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

<readonly> idPropertyName :string

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

<readonly> name :string|Symbol

Record type name (same as recordTypeName property inherited from the properties container).
Type:
  • string | Symbol

<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
Inherited From:

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

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

<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
Inherited From:

<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>
Inherited From:

<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
Inherited From:

Methods


getPropertyDesc(propName)

Get specified property descriptor.
Parameters:
Name Type Description
propName string Property name.
Inherited From:
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.
Inherited From:
Returns:
true if there is such property.
Type
boolean

isPolymorph()

Tell if polymorphic object or reference container.
Inherited From:
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.
Inherited From:
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.
Inherited From:
Returns:
true if polymorphic reference container.
Type
boolean

isRecordType()

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

refToId(ref)

Convert reference to a record of this record type to the record id.
Parameters:
Name Type Description
ref string Record reference.
Throws:
If reference has invalid syntax.
Type
module:x2node-common.X2SyntaxError
Returns:
Record id.
Type
string | number