Packageorg.spicefactory.lib.command.lifecycle
Classpublic class DefaultCommandLifecycle
InheritanceDefaultCommandLifecycle Inheritance Object
Implements CommandLifecycle
Subclasses ManagedCommandLifecycle

Default implementation of the CommandLifecycle interface.

This implementation uses the specified CommandData to peform constructor injection when creating a new command instance. The beforeExecution and afterCompletion hooks in this implementation do nothing.



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

Creates a new instance.

Parameters
domain:ApplicationDomain (default = null) — the domain to use for reflecting on command classes
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