Packageorg.puremvc.as3.multicore.core
Classpublic class Model
ImplementsIModel

A Multiton IModel implementation.

In PureMVC, the Model class provides access to model objects (Proxies) by named lookup.

The Model assumes these responsibilities:

Your application must register IProxy instances with the Model. Typically, you use an ICommand to create and register IProxy instances once the Facade has initialized the Core actors.

See also

Proxy
IProxy


Protected Properties
 PropertyDefined by
  instanceMap : Array
[static]
Model
  multitonKey : String
Model
  proxyMap : Array
Model
Public Methods
 MethodDefined by
  
Model(key:String)
Constructor.
Model
  
getInstance(key:String):IModel
[static] Model Multiton Factory method.
Model
  
hasProxy(proxyName:String):Boolean
Check if a Proxy is registered
Model
  
registerProxy(proxy:IProxy):void
Register an IProxy with the Model.
Model
  
removeModel(key:String):void
Remove an IModel instance
Model
  
removeProxy(proxyName:String):IProxy
Remove an IProxy from the Model.
Model
  
retrieveProxy(proxyName:String):IProxy
Retrieve an IProxy from the Model.
Model
Protected Methods
 MethodDefined by
  
Initialize the Model instance.
Model
Protected Constants
 ConstantDefined by
  MULTITON_MSG : String = "Model instance for this Multiton key already constructed!"
Model
Property detail
instanceMapproperty
protected static var instanceMap:Array
multitonKeyproperty 
protected var multitonKey:String
proxyMapproperty 
protected var proxyMap:Array
Constructor detail
Model()constructor
public function Model(key:String)

Constructor.

This IModel implementation is a Multiton, so you should not call the constructor directly, but instead call the static Multiton Factory method Model.getInstance( multitonKey )

Parameters
key:String

Throws
— Error if instance for this Multiton key instance has already been constructed
Method detail
getInstance()method
public static function getInstance(key:String):IModel

Model Multiton Factory method.

Parameters
key:String

Returns
IModel — the instance for this Multiton key
hasProxy()method 
public function hasProxy(proxyName:String):Boolean

Check if a Proxy is registered

Parameters
proxyName:String

Returns
Boolean — whether a Proxy is currently registered with the given proxyName.
initializeModel()method 
protected function initializeModel():void

Initialize the Model instance.

Called automatically by the constructor, this is your opportunity to initialize the Singleton instance in your subclass without overriding the constructor.

registerProxy()method 
public function registerProxy(proxy:IProxy):void

Register an IProxy with the Model.

Parameters
proxy:IProxy — an IProxy to be held by the Model.
removeModel()method 
public function removeModel(key:String):void

Remove an IModel instance

Parameters
key:String — of IModel instance to remove
removeProxy()method 
public function removeProxy(proxyName:String):IProxy

Remove an IProxy from the Model.

Parameters
proxyName:String — name of the IProxy instance to be removed.

Returns
IProxy — the IProxy that was removed from the Model
retrieveProxy()method 
public function retrieveProxy(proxyName:String):IProxy

Retrieve an IProxy from the Model.

Parameters
proxyName:String

Returns
IProxy — the IProxy instance previously registered with the given proxyName.
Constant detail
MULTITON_MSGconstant
protected const MULTITON_MSG:String = "Model instance for this Multiton key already constructed!"