Packageorg.robotlegs.core
Interfacepublic interface ICommandMap
Implementors CommandMap

The Robotlegs CommandMap contract



Public Methods
 MethodDefined By
  
detain(command:Object):void
Detain a Command instance
ICommandMap
  
execute(commandClass:Class, payload:Object = null, payloadClass:Class = null, named:String):void
Execute a Command with an optional payload The commandClass must implement an execute() method
ICommandMap
  
hasEventCommand(eventType:String, commandClass:Class, eventClass:Class = null):Boolean
Check if a Class has been mapped to an Event type
ICommandMap
  
mapEvent(eventType:String, commandClass:Class, eventClass:Class = null, oneshot:Boolean = false):void
Map a Class to an Event type The commandClass must implement an execute() method
ICommandMap
  
release(command:Object):void
Release a Command instance
ICommandMap
  
unmapEvent(eventType:String, commandClass:Class, eventClass:Class = null):void
Unmap a Class to Event type mapping
ICommandMap
  
Removes all mappings made through mapEvent
ICommandMap
Method Detail
detain()method
public function detain(command:Object):void

Detain a Command instance

Parameters

command:Object — The Command instance to detain

execute()method 
public function execute(commandClass:Class, payload:Object = null, payloadClass:Class = null, named:String):void

Execute a Command with an optional payload

The commandClass must implement an execute() method

Parameters

commandClass:Class — The Class to instantiate - must have an execute() method
 
payload:Object (default = null) — An optional payload
 
payloadClass:Class (default = null) — An optional class to inject the payload as
 
named:String — An optional name for the payload injection


Throws
org.robotlegs.base::ContextError
hasEventCommand()method 
public function hasEventCommand(eventType:String, commandClass:Class, eventClass:Class = null):Boolean

Check if a Class has been mapped to an Event type

Parameters

eventType:String — The Event type
 
commandClass:Class — The Class
 
eventClass:Class (default = null) — Optional Event class for a stronger mapping. Defaults to flash.events.Event.

Returns
Boolean — Whether the Class is mapped to this Event type
mapEvent()method 
public function mapEvent(eventType:String, commandClass:Class, eventClass:Class = null, oneshot:Boolean = false):void

Map a Class to an Event type

The commandClass must implement an execute() method

Parameters

eventType:String — The Event type to listen for
 
commandClass:Class — The Class to instantiate - must have an execute() method
 
eventClass:Class (default = null) — Optional Event class for a stronger mapping. Defaults to flash.events.Event. Your commandClass can optionally [Inject] a variable of this type to access the event that triggered the command.
 
oneshot:Boolean (default = false) — Unmap the Class after execution?


Throws
org.robotlegs.base::ContextError
release()method 
public function release(command:Object):void

Release a Command instance

Parameters

command:Object — The Command instance to release for garbage collection

unmapEvent()method 
public function unmapEvent(eventType:String, commandClass:Class, eventClass:Class = null):void

Unmap a Class to Event type mapping

Parameters

eventType:String — The Event type
 
commandClass:Class — The Class to unmap
 
eventClass:Class (default = null) — Optional Event class for a stronger mapping. Defaults to flash.events.Event.

unmapEvents()method 
public function unmapEvents():void

Removes all mappings made through mapEvent