new PropertyDescriptor(ctx, container, propName, propDef [, viewOfDesc])
Note: The constructor is not accessible from the client
code. Property descriptors are created internally and are available via
the property container's
getPropertyDesc()
method.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
ctx |
module:x2node-records~LibraryConstructionContext | Library construction context. | |
container |
module:x2node-records~PropertiesContainer | The container, to which the property belongs. | |
propName |
string | Property name. | |
propDef |
Object | Property definition. | |
viewOfDesc |
module:x2node-records~PropertyDescriptor |
<optional> |
For a view property, descriptor of the base property. |
Members
-
<readonly> allowDuplicates :boolean
-
For a non-object array property, tells if duplicates values are allowed.
Type:
- boolean
-
<readonly> container :module:x2node-records~PropertiesContainer
-
Container, to which the property belongs.
Type:
-
<readonly> containerChain :Array.<module:x2node-records~PropertiesContainer>
-
Container chain. The first element in the chain is the record type descriptor, the last element is the property container (same one as in
container
descriptor property).Type:
-
<readonly> definition :Object
-
Property definition.
Type:
- Object
-
<readonly> modifiable :boolean
-
true
if the property is modifiable. Note, that being not modifiable does not necessarily mean immutable. It merely means that setting a new value directly to the property is disallowed.Type:
- boolean
-
<readonly> name :string
-
Property name.
Type:
- string
-
<readonly, nullable> nestedProperties :module:x2node-records~PropertiesContainer
-
For a nested object property (
scalarValueType
is "object"), the descriptors of the nested properties. For a reference property (scalarValueType
is "ref"), the target record type descriptor. For a non-object, non-reference property, if it is not scalar the container describes a single property named "$value" with the scalar value type. If it is scalar, thenestedProperties
value isnull
. For a polymorphic nested object or reference property, this is the polymoprhic container.Type:
-
<readonly> optional :boolean
-
true
if the property is optional.Type:
- boolean
-
<readonly> refTarget :string
-
Name of the target record type for a non-polymorphic reference property (
isRef()
returnstrue
).Type:
- string
-
<readonly> refTargets :Array.<string>
-
For a polymoprhic reference property, a shortcut property that contains a list of names of all allowed referred record types. This is a shortcut for
nestedProperties.subtypes
.Type:
- Array.<string>
-
<readonly> scalarValueType :string
-
Scalar value type of the property. One of "string", "number", "boolean", "datetime", "object" or "ref".
Type:
- string
-
<readonly> viewOfDesc :module:x2node-records~PropertyDescriptor
-
For a view property, descriptor of the base property.
Type:
Methods
-
isArray()
-
Tell if the property is an array.
Returns:
true
if the property is an array.- Type
- boolean
-
isCalculated()
-
Tell if this is a calculated value property. Calculated properties are similar to view properties. They are not stored in the record persistent storage and their values are calculated on the fly based on other record property values. Calculated properties can be included when the record is read from the persistent storage and are ignored when the record is saved into the persistent storage. This flag is used in extensions and is not used in the core record types library implementation directly. Unless overridden in an extension, the method returns
false
for all properties.Returns:
true
if calculated property.- Type
- boolean
-
isGenerated()
-
Tell if the property value is automatically generated when a new record is saved into the records persistent storage. This flag is used in extensions and is not used in the core record types library implementation directly. Unless overridden in an extension, the method returns
false
for all properties.Returns:
true
if generated property.- Type
- boolean
-
isId()
-
Tell if the property is a record (including nested object) id.
Returns:
true
if the property is an id.- Type
- boolean
-
isMap()
-
Tell if the property is a map.
Returns:
true
if the property is a map.- Type
- boolean
-
isPolymorphObject()
-
A shortcut method that tells if the property is a polymoprhic nested object property. Such property will have
scalarValueType
of "object" and itsnestedProperties.isPolymorphObject()
will returntrue
.Returns:
true
if polymorphic nested object property.- Type
- boolean
-
isPolymorphObjectType()
-
Tell if the property is a special hidden property describing the polymorphic object type. Any container whose
isPolymorphObject()
method returnstrue
will have one such property. Note, that the property is hidden, so it is not listed in the container'sallPropertyNames
list, but it is available via thehasProperty()
andgetPropertyDesc()
methods.Returns:
true
if type property.- Type
- boolean
-
isPolymorphRef()
-
A shortcut method that tells if the property is a polymoprhic reference property. Such property will have
scalarValueType
of "object" and itsnestedProperties.isPolymorphRef()
will returntrue
.Returns:
true
if polymorphic reference property.- Type
- boolean
-
isRecordMetaInfo()
-
Tell if the property is a record meta-info property. Record meta-info properties are special propeties automatically maintained by the library that describe some technical aspects of the record, such as creation and modification timestamps, record version, etc. Meta-info properties can be included when the record is read from the persistent storage and are ignored when the record is saved into the persistent storage. This flag is used in extensions and is not used in the core record types library implementation directly. Unless overridden in an extension, the method returns
false
for all properties.Returns:
true
if record meta-info property.- Type
- boolean
-
isRef()
-
Tell if the property is a non-polymorphic reference (
scalarValueType
is "ref"). Note, that this does not include polymorphic reference properties whosescalarValueType
is "object".Returns:
true
if the property is a non-polymorphic reference.- Type
- boolean
-
isScalar()
-
Tell if the property is scalar.
Returns:
true
if the property is scalar.- Type
- boolean
-
isSubtype()
-
Tell if the property is a pseudo-property representing its polymorphic container's subtype-specific properties. Every polymoprhic container (container descriptor's
isPolymorph()
method returnstrue
) has one such pseudo-property for each subtype. For a polymorphic object container, the property name is the subtype name, the type is an optional scalar "object", and the nested properties are the subtype-specific properties. For a polymoprhic reference container, the property name is one of the referred record type names and the type is "ref".Returns:
true
if a subtype pseudo-property.- Type
- boolean
-
isView()
-
Tell if the property is a view of another property.
Returns:
true
if the property is a view.- Type
- boolean