Documentation
    Preparing search index...

    Class ObjectProperty

    A relational property type designed to store references to other BaseObjectClass instances. Handles polymorphic resolution between raw ObjectUri, underlying DataObject, or the full class instance.

    const owner = new ObjectProperty({
    name: 'owner',
    instanceOf: User
    });

    owner.set(userInstance);
    const uri = owner.val(returnAs.AS_OBJECTURIS); // Returns just the reference

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _allows: string[] = []
    _defaultValue: any
    _events: { [key: string]: Function } = {}
    _hasChanged: boolean
    _htmlType: PropertyHTMLType = 'off'
    _id: string
    _instanceOf: any

    The class constructor or class name string the object must match.

    _mandatory: boolean = false
    _name: string
    _parent: DataObjectClass<any> | undefined
    _protected: boolean = false
    _value: ObjectUri | BaseObjectClass | undefined = undefined

    The internal stored value, either a class instance or a URI.

    EVENT_ONCHANGE: string = 'onChange'

    Event name triggered when the property value changes.

    EVENT_ONDELETE: string = 'onDelete'

    Event name triggered when the property is deleted.

    TYPE: string = 'object'

    The string literal type identifier for this property.

    Accessors

    • get allows(): string[]

      Returns string[]

    • get hasChanged(): boolean

      Returns boolean

    • set hasChanged(val: boolean): void

      Parameters

      • val: boolean

      Returns void

    • get htmlType(): PropertyHTMLType

      Returns PropertyHTMLType

    • set htmlType(type: PropertyHTMLType): void

      Parameters

      Returns void

    • get instanceOf(): any

      Returns any

    • get mandatory(): boolean

      Returns boolean

    • get name(): string

      Returns string

    • get protected(): boolean

      Returns boolean

    Methods

    • Parameters

      • value: boolean | undefined

      Returns value is true | undefined

    • Creates a deep clone of the current property instance, preserving its prototype chain.

      Returns any

      A new independent instance of the property.

    • Assigns an object or an object reference to the property. Validates that the provided object matches the instanceOf class definition.

      Parameters

      • value: object

        The BaseObjectClass, DataObject, or ObjectUri to assign.

      • setChanged: boolean = true

        Whether to mark the property as modified.

      Returns ObjectProperty

      The property instance for chaining.

      If the assigned value is not an instance of the configured class.

    • Serializes the object property into a reference format suitable for storage.

      Returns any

      The ObjectUri JSON representation, or a reference object.

    • Retrieves the object, optionally resolving it to a specific representation.

      Parameters

      • transform: string | undefined = undefined

        The desired format (returnAs.AS_OBJECTURIS, AS_DATAOBJECTS, AS_INSTANCES).

      Returns any

      The resolved object, data object, or URI based on the requested transform.