Packageorg.spicefactory.lib.command.lifecycle
Interfacepublic interface CommandLifecycle
Implementors DefaultCommandLifecycle

Represents the lifecycle of a command. This is a hook that can be used by frameworks to add functionality to the command execution. A typical example is integration into an IOC container where the command is supposed to be managed by the container for the time it is getting executed and where the creation of the command instance may also be managed by the container. But this in entirely generic hook that can be used for any kind of additional functionality.



Public Methods
 MethodDefined By
  
afterCompletion(command:Object, result:CommandResult):void
Lifecycle hook to be invoked after the command finished execution.
CommandLifecycle
  
beforeExecution(command:Object, data:CommandData):void
Lifecycle hook to be invoked immediately before the command gets executed.
CommandLifecycle
  
createInstance(type:Class, data:CommandData):Object
Creates a new command instance of the specified type.
CommandLifecycle
Method Detail
afterCompletion()method
public function afterCompletion(command:Object, result:CommandResult):void

Lifecycle hook to be invoked after the command finished execution. This includes successful completion as well as cancellation and errors.

Parameters

command:Object — the command that finished executing
 
result:CommandResult — the result produced by the command

beforeExecution()method 
public function beforeExecution(command:Object, data:CommandData):void

Lifecycle hook to be invoked immediately before the command gets executed.

Parameters

command:Object — the command to be executed
 
data:CommandData — the data passed to the command by the executor

createInstance()method 
public function createInstance(type:Class, data:CommandData):Object

Creates a new command instance of the specified type. The data passed to this method may be used to perform constructor injection or similar tasks.

Parameters

type:Class — the type of command to create
 
data:CommandData — the data passed to the command by the executor

Returns
Object — a new command instance