Package org.puremvc.as3.core
Class public class Model
Implements IModel
A Singleton 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
  Property Defined by
    instance : IModel
[static]
Model
    proxyMap : Array
Model

Public Methods
  Method Defined by
   
Model()
Constructor.
Model
   
[static] Model Singleton 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
   
removeProxy(proxyName:String):IProxy
Remove an IProxy from the Model.
Model
   
retrieveProxy(proxyName:String):IProxy
Retrieve an IProxy from the Model.
Model

Protected Methods
  Method Defined by
   
Initialize the Singleton Model instance.
Model

Protected Constants
  Constant Defined by
    SINGLETON_MSG : String = "Model Singleton already constructed!"
Model
Property detail
instance property
protected static var instance:IModel
proxyMap property  
protected var proxyMap:Array
Constructor detail
Model () constructor
public function Model()

Constructor.

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


Throws
— Error if Singleton instance has already been constructed
Method detail
getInstance () method
public static function getInstance():IModel

Model Singleton Factory method.

Returns
IModel — the Singleton instance
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 Singleton 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.
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
SINGLETON_MSG constant
protected const SINGLETON_MSG:String = "Model Singleton already constructed!"