Maps specific messages to ICommand.

Methods

clear():ICommandMapper

Clears all mappings.

executeCommand(commandClass:Class<ICommand>, ?data:Dynamic, ?guardList:Array<Class<IGuards>>, ?guardNotList:Array<Class<IGuards>>):Bool

Execute command manually.

Parameters:

commandClass
data

Plain data object, which properties will be injected into ICommand

guardList

List of guards, that will allow or not command execution

guardNotList

List of opposite guards

@:value({ stopOnExecute : false, once : false, data : null })map(messageType:EnumValue, commandClass:Class<ICommand>, ?data:Dynamic, once:Bool = false, stopOnExecute:Bool = false):MappingConfig

Maps message to command. When message occurred, specified command will be implemented.

Parameters:

messageType
commandClass
data

Plain data object, which properties will be injected into ICommand. If command executed via message, and message contains data object, data specified in map method will be overridden by IMessage data

once

Messaged will be automatically unmapped, after command execution

stopOnExecute

If true, ICommandMapper will stop executing other commands mapped to current message

@:value({ stopOnExecute : false, once : false, data : null })map1(messageType:EnumValue, commandClassList:Array<Class<ICommand>>, ?data:Dynamic, once:Bool = false, stopOnExecute:Bool = false):MappingConfigList

See also:

  • map

@:value({ stopOnExecute : false, once : false, data : null })map2(messageTypeList:Array<EnumValue>, commandClass:Class<ICommand>, ?data:Dynamic, once:Bool = false, stopOnExecute:Bool = false):MappingConfigList

See also:

  • map

@:value({ stopOnExecute : false, once : false, data : null })map3(messageTypeList:Array<EnumValue>, commandClassList:Array<Class<ICommand>>, ?data:Dynamic, once:Bool = false, stopOnExecute:Bool = false):MappingConfigList

See also:

  • map

setMergeMessageDataAndMappingData(value:Bool):ICommandMapper

If true, then message data object will be merged with mapping data object. Mapping data will be in priority. Otherwise mapping data will be replaced by message data (if has one). By default is false, and mapping data will be replaced with message data (if has one).

Parameters:

null

value

tryToExecuteCommand(message:IMessage):Void

Trying to find and execute commands, mapped to current message type.

Parameters:

null

message

unmap(messageType:EnumValue, commandClass:Class<ICommand>):ICommandMapper

Unmaps message from command.

Parameters:

messageType
null

commandClass

unmapAll(messageType:EnumValue):ICommandMapper

Unmaps all commands from specified message.

Parameters:

null

messageType