| Package | org.robotlegs.base |
| Class | public class CommandMap |
| Inheritance | CommandMap Object |
| Implements | ICommandMap |
ICommandMap implementation
| Property | Defined By | ||
|---|---|---|---|
| detainedCommands : Dictionary | CommandMap | ||
| eventDispatcher : IEventDispatcher
The IEventDispatcher to listen to
| CommandMap | ||
| eventTypeMap : Dictionary
Internal
TODO: This needs to be documented
| CommandMap | ||
| injector : IInjector
The IInjector to inject with
| CommandMap | ||
| reflector : IReflector
The IReflector to reflect with
| CommandMap | ||
| verifiedCommandClasses : Dictionary
Internal
Collection of command classes that have been verified to implement an execute method
| CommandMap | ||
| Method | Defined By | ||
|---|---|---|---|
Creates a new CommandMap object
| CommandMap | ||
detain(command:Object):void
Detain a Command instance
| CommandMap | ||
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
| CommandMap | ||
hasEventCommand(eventType:String, commandClass:Class, eventClass:Class = null):Boolean
Check if a Class has been mapped to an Event type
| CommandMap | ||
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
| CommandMap | ||
release(command:Object):void
Release a Command instance
| CommandMap | ||
unmapEvent(eventType:String, commandClass:Class, eventClass:Class = null):void
Unmap a Class to Event type mapping
| CommandMap | ||
unmapEvents():void
Removes all mappings made through mapEvent
| CommandMap | ||
| Method | Defined By | ||
|---|---|---|---|
routeEventToCommand(event:Event, commandClass:Class, oneshot:Boolean, originalEventClass:Class):Boolean
Event Handler
| CommandMap | ||
verifyCommandClass(commandClass:Class):void | CommandMap | ||
| detainedCommands | property |
protected var detainedCommands:Dictionary| eventDispatcher | property |
protected var eventDispatcher:IEventDispatcher
The IEventDispatcher to listen to
| eventTypeMap | property |
protected var eventTypeMap:DictionaryInternal TODO: This needs to be documented
| injector | property |
protected var injector:IInjector
The IInjector to inject with
| reflector | property |
protected var reflector:IReflector
The IReflector to reflect with
| verifiedCommandClasses | property |
protected var verifiedCommandClasses:Dictionary
Internal
Collection of command classes that have been verified to implement an execute method
| CommandMap | () | Constructor |
public function CommandMap(eventDispatcher:IEventDispatcher, injector:IInjector, reflector:IReflector)
Creates a new CommandMap object
eventDispatcher:IEventDispatcher — The IEventDispatcher to listen to
| |
injector:IInjector — An IInjector to use for this context
| |
reflector:IReflector — An IReflector to use for this context
|
| detain | () | method |
public function detain(command:Object):voidDetain 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):voidExecute 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
|
| hasEventCommand | () | method |
public function hasEventCommand(eventType:String, commandClass:Class, eventClass:Class = null):BooleanCheck 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.
|
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):voidMap 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?
|
| release | () | method |
public function release(command:Object):voidRelease a Command instance
Parameters
command:Object — The Command instance to release for garbage collection
|
| routeEventToCommand | () | method |
protected function routeEventToCommand(event:Event, commandClass:Class, oneshot:Boolean, originalEventClass:Class):BooleanEvent Handler
Parameters
event:Event — The Event
| |
commandClass:Class — The Class to construct and execute
| |
oneshot:Boolean — Should this command mapping be removed after execution?
| |
originalEventClass:Class |
Boolean — true if the event was routed to a Command and the Command was executed,
false otherwise
|
| unmapEvent | () | method |
public function unmapEvent(eventType:String, commandClass:Class, eventClass:Class = null):voidUnmap 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
| verifyCommandClass | () | method |
protected function verifyCommandClass(commandClass:Class):void
Parameters
commandClass:Class |
org.robotlegs.base::ContextError —
|