Packageorg.restfulx.controllers
Classpublic class CommandsController

Manages registered commands (classes that implement org.restfulx.controllers.ICommand).



Public Methods
 MethodDefined by
  
CommandsController(commands:Array)
Creates a new instance of the controller.
CommandsController
  
addCommand(cmd:Class, useWeakReference:Boolean = true):void
Adds a given command class to the controller registry.
CommandsController
  
addCommandByName(cmdName:String, cmd:Class, useWeakReference:Boolean = true):void
Adds a given command using provided name (as opposed to inferred name) to the controller registry.
CommandsController
  
execute(cmd:Object, data:Object = null, targetServiceId:int = -1):void
Executes a given command passing data and target service id for reference.
CommandsController
  
removeCommand(cmd:Class):void
Removes a given command from the registry.
CommandsController
  
removeCommandByName(cmdName:String):void
Removes a given command from the registry using the name provided.
CommandsController
Constructor detail
CommandsController()constructor
public function CommandsController(commands:Array)

Creates a new instance of the controller.

Parameters
commands:Array — the array of command classes to register e.g. [Command1, Command2]
Method detail
addCommand()method
public function addCommand(cmd:Class, useWeakReference:Boolean = true):void

Adds a given command class to the controller registry.

Parameters
cmd:Class — command class
 
useWeakReference:Boolean (default = true) — will be registered for events using a weak reference
addCommandByName()method 
public function addCommandByName(cmdName:String, cmd:Class, useWeakReference:Boolean = true):void

Adds a given command using provided name (as opposed to inferred name) to the controller registry.

Parameters
cmdName:String — command name to use
 
cmd:Class — Command class that will be invoked
 
useWeakReference:Boolean (default = true) — will be registered for events using a weak referece
execute()method 
public function execute(cmd:Object, data:Object = null, targetServiceId:int = -1):void

Executes a given command passing data and target service id for reference.

Parameters
cmd:Object — command to execute. This can be either a String or a Class.
 
data:Object (default = null) — arbitrary data to pass to the command
 
targetServiceId:int (default = -1) — indicates which service the command should use (if any)
removeCommand()method 
public function removeCommand(cmd:Class):void

Removes a given command from the registry.

Parameters
cmd:Class — command class to remove

See also

addCommand
removeCommandByName()method 
public function removeCommandByName(cmdName:String):void

Removes a given command from the registry using the name provided.

Parameters
cmdName:String — command class to remove

See also

addCommandByName