Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetInstance ¶
func GetInstance(key string, factory func() interfaces.IModel) interfaces.IModel
GetInstance Model Multiton Factory method.
- parameter key: multitonKey
- parameter factory: reference that returns IModel
- returns: the instance returned by the passed factory
func RemoveModel ¶
func RemoveModel(key string)
RemoveModel Remove an IModel instance
- parameter multitonKey: of IModel instance to remove
Types ¶
type Model ¶
type Model struct {
Key string // The Multiton Key for this Core
// contains filtered or unexported fields
}
Model A Multiton IModel implementation.
In PureMVC, the Model class provides access to model objects (Proxies) by named lookup.
The Model assumes these responsibilities:
* Maintain a cache of IProxy instances.
* Provide methods for registering, retrieving, and removing IProxy instances.
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.
func (*Model) HasProxy ¶
HasProxy Check if a Proxy is registered
- parameter proxyName:
- returns: whether a Proxy is currently registered with the given proxyName.
func (*Model) InitializeModel ¶
func (self *Model) InitializeModel()
InitializeModel Initialize the Model instance.
Called automatically by the GetInstance, this is your opportunity to initialize the Multiton instance in your subclass without overriding the constructor.
func (*Model) RegisterProxy ¶
func (self *Model) RegisterProxy(proxy interfaces.IProxy)
RegisterProxy Register an IProxy with the Model.
- parameter proxy: an IProxy to be held by the Model.
func (*Model) RemoveProxy ¶
func (self *Model) RemoveProxy(proxyName string) interfaces.IProxy
RemoveProxy Remove an IProxy from the Model.
- parameter proxyName: name of the IProxy instance to be removed.
- returns: the IProxy that was removed from the Model
func (*Model) RetrieveProxy ¶
func (self *Model) RetrieveProxy(proxyName string) interfaces.IProxy
RetrieveProxy Retrieve an IProxy from the Model.
- parameter proxyName:
- returns: the IProxy instance previously registered with the given proxyName.