.. _object_Object: :index:`Object` --------------- Description *********** The Object object provides basic common functionality for all objects such as the :ref:`completed() ` signal and the :ref:`objectId ` and :ref:`parent ` properties. :**› Inherited by**: :ref:`ApplicationView `, :ref:`ByteArray `, :ref:`Comparator `, :ref:`Component `, :ref:`Configuration `, :ref:`ConfigurationArray `, :ref:`ConfigurationObject `, :ref:`Counter `, :ref:`CsvWriter `, :ref:`DataObject `, :ref:`DataObjectGroup `, :ref:`DataObjectView `, :ref:`DataObjectWriter `, :ref:`DhcpServer `, :ref:`DockerContainer `, :ref:`DockerMount `, :ref:`DockerNetwork `, :ref:`DockerObject `, :ref:`ErrorCollector `, :ref:`EventJournal `, :ref:`EventLog `, :ref:`EventLogItem `, :ref:`EventOutput `, :ref:`File `, :ref:`InMemoryStorage `, :ref:`IoDevice `, :ref:`JsonRpcClient `, :ref:`JsonRpcServer `, :ref:`LicensingCertificate `, :ref:`List `, :ref:`LocalRepository `, :ref:`Mail `, :ref:`MailAddress `, :ref:`NetworkRoute `, :ref:`NftChain `, :ref:`NftFirewall `, :ref:`NftRule `, :ref:`NftStatement `, :ref:`NftTable `, :ref:`ObjectArray `, :ref:`Process `, :ref:`PropertyModifier `, :ref:`Repository `, :ref:`Serializer `, :ref:`Settings `, :ref:`SmtpConfiguration `, :ref:`Storage `, :ref:`System `, :ref:`SystemJournal `, :ref:`SystemService `, :ref:`TcpServer `, :ref:`Timer `, :ref:`Translator `, :ref:`UpdateManager `, :ref:`UpdateTarget ` Overview ******** Properties ++++++++++ .. hlist:: :columns: 1 * :ref:`objectId ` * :ref:`parent ` Methods +++++++ .. hlist:: :columns: 1 * :ref:`deserializeProperties() ` * :ref:`fromJson() ` * :ref:`serializeProperties() ` * :ref:`toJson() ` Signals +++++++ .. hlist:: :columns: 1 * :ref:`completed() ` Properties ********** .. _property_Object_objectId: .. _signal_Object_objectIdChanged: .. index:: single: objectId objectId ++++++++ This property holds an optional ID for the object in case the object does not have an QML ID assigned. Like the QML ID the object ID should be a simple string with alphanumeric characters only. :**› Type**: String :**› Signal**: objectIdChanged() :**› Attributes**: Writable .. _property_Object_parent: .. _signal_Object_parentChanged: .. index:: single: parent parent ++++++ This property holds a reference to the current parent of the object. :**› Type**: :ref:`Object ` :**› Signal**: parentChanged() :**› Attributes**: Writable Methods ******* .. _method_Object_deserializeProperties: .. index:: single: deserializeProperties deserializeProperties(Map variantMap) +++++++++++++++++++++++++++++++++++++ This method deserializes (loads) the corresponding properties of this object instance and children objects. It works similarly to :ref:`fromJson() ` but takes a map/dictionary instead of a JSON string. This method was introduced in InCore 2.4. .. _method_Object_fromJson: .. index:: single: fromJson fromJson(String data) +++++++++++++++++++++ This method parses the specified JSON string and deserializes (loads) the corresponding properties of this object instance and children objects. .. _method_Object_serializeProperties: .. index:: single: serializeProperties serializeProperties(:ref:`Object.SerializeFilter ` filter) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This method serializes (saves) the corresponding properties of this object instance and children objects. It works similarly to :ref:`toJson() ` but returns a map/dictionary instead of a JSON string. This method was introduced in InCore 2.5. :**› Returns**: Map .. _method_Object_toJson: .. index:: single: toJson toJson(JSValue jsValue) +++++++++++++++++++++++ This method returns a JSON representation of all properties of this instance and all children objects if no argument is passed. If the argument is a property or a JavaScript value (object, array etc.) it is converted to a human-readable JSON string. This allows dumping complex data structures easily while debugging. When requiring additional control over how and which properties are to be serialized, :ref:`Serializer ` should be used instead. :**› Returns**: String Signals ******* .. _signal_Object_completed: .. index:: single: completed completed() +++++++++++ This signal is emitted when the object and all its children objects have been loaded and initialized completely. A handler for this signal can be used to start certain operations such as opening a resource, initiating a connection or logging the successful initialization. .. note:: Most operational objects provide properties for automatically starting their operation and should be used instead of calling the corresponding methods manually in a handler of this signal. .. _example_Object: Example ******* .. code-block:: qml import InCore.Foundation 2.5 Application { Object { objectId: "testObject" property string foo: "bar" onCompleted: { console.log("Hello world, I'm", objectId, "and my vendor is", parent.vendor) console.log("My JSON representation is", toJson()) } } }