menu

SiteGenesis / Server-side JS / Module: models/AbstractModel

Model for prototype model functionality.

Source:

module:models/AbstractModel

The AbstractModel class

Source:

Classes

AbstractModel

Members

(inner) object

Property holding the wrapped object that is initialized in the child classes. Usually, the static get() method of the app.js module is used to obtain a model instance.

Source:

Methods

(inner) AbstractModel/__noSuchMethod__(methodName, methodArgs)

Fallback to use wrapped object's native functions in case method is not defined. The logic will try to invoke method for this.object, and throw TypeError if the method does not exist

Parameters:
Name Type Description
methodName String

The name of a method to use as a fallback.

methodArgs Array

The arguments for the method.

Source:
Throws:
TypeError
Returns:

Record Result or exception if the method does not exist.

(abstract, inner) AbstractModel/get() → {Void}

Returns a wrapped object instance. This method needs to be implemented by the subclasses.

Source:
Returns:
Type
Void

(inner) AbstractModel/getValue(key) → {Object}

Gets value from prepopulated object. If the key is point-delimited, parses JSON If not, obtains a value from "custom" property of an object

Parameters:
Name Type Description
key String

The JSON key to retrieve a value for.

Source:
Returns:
Type
Object

(inner) AbstractModel/initProperties()

Creates property access and delegate it to the appropriate getters & setters of the wrapper or wrapped object

Source:

(inner) AbstractModel/setValue.() → {Boolean}

Sets value to prepopulated object. If the key is point-delimited, parses JSON and sets up a target value.

Source:
Returns:

true if value is successfully set.

Type
Boolean