A Reference Object provides a reference to Axiom Object instance. You can declare a property to be of type Reference in the prototype.properties file. Since Axiom Objects can only exist in one location, this is useful for referencing them from anywhere. A Reference Object is instantiated as follows:
var hp = root.get("homepage"); // An Axiom Object that is an instance of the HomePage prototype
var cat = hp.get("category"); // This is an Axiom Object.
var hp.cat_ref = new Reference(cat); // cat_ref is a Reference property on the HomePage prototype
Below are the properties and methods available to References.
Contents |
Reference.sourceId
Description
Reference.sourceId
(Number) - The _id number of the source Axiom Object.
Reference.sourcePath
Description
Reference.sourcePath
(String) - The path of the source Axiom Object.
Reference.sourceProperty
Description
Reference.sourceProperty
(String) - The name of the Reference property on the source Axiom Object.
Reference.targetId
Description
Reference.targetId
(Number) - The _id number of the target Axiom Object.
Reference.targetPath
Description
Reference.targetPath
(String) - The path of the target Axiom Object.
Reference.getSource()
Description
Reference.getSource()
Returns the source Axiom Object.
Returns
(AxiomObject) - The source Axiom Object.
Reference.getTarget()
Description
Reference.getTarget()
De-references the reference, and returns the instance of the Axiom Object being referenced.
Returns
(AxiomObject) - The instance of the Axiom Object being referenced.
