Hemi JavaScript Framework

Hemi.object

Description

The object utility class includes an API decorator for object mapping.

static Hemi.object

version 3.1.0

Convenience methods for instrumenting object array mapping and retrieval.

Index

Example Index

Property Index

Method Index

Examples

Instrumentation Example

Add an object accessor for conveniently storing and retrieving other objects.

Example Code

var oSomeObject = {};
// Instrument oSomeObject with the object accessor API
Hemi.object.addObjectAccessor(oSomeObject, "demo");
var oChildObject = {};
// Add the chid object as "child1"
oSomeObject.addNewDemo(oChildObject, "child1");
// Retrieve the object reference
var oLookup = oSomeObject.getDemoByName("child1");

Properties

accessorindex

A hash of variant identifiers whose value is the index of accessors. The array is created for an object with implementsObjectAccessor, and is stored on the objects sub structure.

Syntax

array = Hemi.object.accessorindex

accessornames

A hash of variant names whose value is the index of accessors. The array is created for an object with implementsObjectAccessor, and is stored on the objects sub structure.

Syntax

array = Hemi.object.accessornames

accessors

An array of variant values. The array is created for an object with implementsObjectAccessor, and is stored on the objects sub structure.

Syntax

array = Hemi.object.accessors

objects

The objects property is used throughout the Hemi JavaScript Framework to store object pointers. This property as created if it does not exist.

Syntax

object = Hemi.object.objects

Methods

addNewAccessor

Adds the object to the accessor array.

Syntax

b = addNewAccessor( )

Returns

b as boolean: Bit indicating whether the object was added.

addObjectAccessor

Creates object accessors, getAccessorByName, getAccessor, getAccessors, and isAccessor methods, and the Accessors, Accessornames, and Accessorindex arrays on the objects sub structure. It is up to the implementing class to specify the property values jointly in order for the method values to resolve.

Syntax

b = addObjectAccessor( o, s )

Parameters

Returns

b as boolean: Returns true if the accessors were created.

addObjectDeconstructor

Creates the deconstructors sigterm and destroy.

Syntax

b = addObjectDeconstructor( o )

Parameters

Returns

b as boolean: Returns true if the accessors were created.

clearAccessors

Clears all arrays and array maps.

Syntax

void clearAccessors( )

destroy

Prepares the object to be destroyed. As a decoration, this method invokes any locally defined handle_destroy handler and increments the internal ready_state to five (5). The method is created for an object with addObjectDeconstructor.

Syntax

void destroy( )

getAccessor

Returns the accessor for the given index. The method is created for an object with implementsObjectAccessor.

Syntax

v = getAccessor( )

Returns

v as variant: The value of the accessor.

getAccessorByName

Returns the accessor based on the specified name. The method is created for an object with implementsObjectAccessor.

Syntax

v = getAccessorByName( )

Returns

v as variant: The value of the accessor.

getAccessors

Returns the accessors array. The method is created for an object with implementsObjectAccessor.

Syntax

a = getAccessors( )

Returns

a as array: The accessor array.

isAccessor

Returns true if the accessor exists. The method is created for an object with implementsObjectAccessor.

Syntax

b = isAccessor( )

Returns

b as boolean: Bit indicating whether the accessor exists.

removeAccessor

Removes the specified object from the accessor arrays.

Syntax

void removeAccessor( )

sigterm

Sends a termination signal to the object. This automatically invokes the destroy method. The method is created for an object with addObjectDeconstructor.

Syntax

void sigterm( )