Packagemvcexpress.core.interfaces
Interfacepublic interface IMediatorMap
Implementors MediatorMap

Interface for Mediator. MediatorsMap use mediators with this interface.



Public Methods
 MethodDefined By
  
isMapped(viewClass:Class, mediatorClass:Class = null):Boolean
Checks if any or specific mediator class is mapped to view class.
IMediatorMap
  
isMediated(viewObject:Object, mediatorClass:Class = null):Boolean
Checks if view object is mediated by any or specific mediator.
IMediatorMap
  
mediate(viewObject:Object):void
Mediates provided viewObject with all mapped mediator.
IMediatorMap
  
mediateWith(viewObject:Object, mediatorClass:Class, injectClass:Class = null):void
Mediates viewObject with specified mediator class.
IMediatorMap
  
unmediate(viewObject:Object, mediatorClass:Class = null):void
Stops view object mediation by all or specific mediator.
IMediatorMap
Method Detail
isMapped()method
public function isMapped(viewClass:Class, mediatorClass:Class = null):Boolean

Checks if any or specific mediator class is mapped to view class.

Parameters

viewClass:Class — view class that has to be mediated by mediator class then mediate(viewObject) is called.
 
mediatorClass:Class (default = null) — Optional Mediator class, if provided will check if viewClass is mapped to this specific mediator class.

Returns
Boolean — true if view class is already mapped to mediator class.
isMediated()method 
public function isMediated(viewObject:Object, mediatorClass:Class = null):Boolean

Checks if view object is mediated by any or specific mediator.

Parameters

viewObject:Object — View object to check if it is mediated.
 
mediatorClass:Class (default = null) — optional parameter to check if view is mediated by specific mediator.

Returns
Boolean
mediate()method 
public function mediate(viewObject:Object):void

Mediates provided viewObject with all mapped mediator. Automatically instantiates mediator class(es), handles all injections(including view object injection), and calls onRegister function.

Throws error if no mediator classes are mapped to viewObject class.

Parameters

viewObject:Object — view object to mediate.

mediateWith()method 
public function mediateWith(viewObject:Object, mediatorClass:Class, injectClass:Class = null):void

Mediates viewObject with specified mediator class.

This function will mediate your view without mapping view class to mediator class. It is usually better practice to use 2 step mediation(map() then mediate()) instead of this function. But sometimes it is not possible/useful.

Parameters

viewObject:Object — view object to mediate.
 
mediatorClass:Class — mediator class that will be instantiated and used to mediate view object
 
injectClass:Class (default = null) — inject mediator as this class.

unmediate()method 
public function unmediate(viewObject:Object, mediatorClass:Class = null):void

Stops view object mediation by all or specific mediator.

If any mediator is mediating this viewObject - onRemove mediator function is called, all message handlers and all event listeners(adedd with addListener) are removed automatically, and mediator is disposed.

Parameters

viewObject:Object — view object witch mediator will be destroyed.
 
mediatorClass:Class (default = null) — optional parameter to unmediate specific mediator class. If this not set - all mediators will be removed.