Packageorg.spicefactory.lib.command.builder
Classpublic class AbstractCommandBuilder
InheritanceAbstractCommandBuilder Inheritance Object
Implements CommandBuilder
Subclasses CommandFlowBuilder, CommandGroupBuilder, CommandProxyBuilder

Abstract base class for all builder types. The builder always produces a proxy responsible for executing the actual command.



Public Methods
 MethodDefined By
  
Creates a new instance.
AbstractCommandBuilder
  
Builds the target command, applying all configurations specified through this builder instance.
AbstractCommandBuilder
  
Builds and executes the target command.
AbstractCommandBuilder
Protected Methods
 MethodDefined By
  
addCancelCallback(callback:Function):void
Adds a callback to invoke when the target command gets cancelled.
AbstractCommandBuilder
  
addData(value:Object):void
Adds a value that can get passed to any command executed by the command proxy this builder creates.
AbstractCommandBuilder
  
addErrorCallback(callback:Function):void
Adds a callback to invoke when the target command produced an error.
AbstractCommandBuilder
  
addResultCallback(callback:Function):void
Adds a callback to invoke when the target command completes successfully.
AbstractCommandBuilder
  
asCommand(command:Object):Command
Turns the specified instance into a command that can be executed by the proxy created by this builder.
AbstractCommandBuilder
  
setDescription(description:String):void
Sets a description of the target command.
AbstractCommandBuilder
  
setDomain(domain:ApplicationDomain):void
Sets the domain to use for reflecting on command classes.
AbstractCommandBuilder
  
setTarget(target:Command):void
Sets the target command to execute.
AbstractCommandBuilder
  
setTimeout(milliseconds:uint):void
Sets the timeout for this proxy.
AbstractCommandBuilder
  
setType(type:Class):void
Sets the type of the command to execute.
AbstractCommandBuilder
Constructor Detail
AbstractCommandBuilder()Constructor
public function AbstractCommandBuilder(proxy:DefaultCommandProxy = null)

Creates a new instance. If no proxy gets passed to this constructor a default implementation will be used.

Parameters
proxy:DefaultCommandProxy (default = null) — proxy to use for executing the target command
Method Detail
addCancelCallback()method
protected function addCancelCallback(callback:Function):void

Adds a callback to invoke when the target command gets cancelled. The callback should not expect any parameters.

Parameters

callback:Function — the callback to invoke when the target command gets cancelled

addData()method 
protected function addData(value:Object):void

Adds a value that can get passed to any command executed by the command proxy this builder creates.

Parameters

value:Object — the value to pass to the command proxy

addErrorCallback()method 
protected function addErrorCallback(callback:Function):void

Adds a callback to invoke when the target command produced an error. The cause of the error will get passed to the callback.

Parameters

callback:Function — the callback to invoke when the target command produced an error

addResultCallback()method 
protected function addResultCallback(callback:Function):void

Adds a callback to invoke when the target command completes successfully. The result produced by the command will get passed to the callback.

Parameters

callback:Function — the callback to invoke when the target command completes successfully

asCommand()method 
protected function asCommand(command:Object):Command

Turns the specified instance into a command that can be executed by the proxy created by this builder. Legal parameters are any instances that implement either Command or CommandBuilder, a Class reference that specifies the type of the target command to create, or any other type in case an adapter is registered that knows how to turn the type into a command.

Parameters

command:Object — instance to turn into a command

Returns
Command — the command created from the specified instance
build()method 
public function build():CommandProxy

Builds the target command, applying all configurations specified through this builder instance.

Returns
CommandProxy — the command proxy will all configuration of this builder applied
execute()method 
public function execute():CommandProxy

Builds and executes the target command. A shortcut for calling build().execute(). In case of asynchronous commands the returned proxy will still be active. In case of synchronous commands it will already be completed, so that adding event listeners won't have any effect.

Returns
CommandProxy — the command that was built and executed by this builder
setDescription()method 
protected function setDescription(description:String):void

Sets a description of the target command. This is primarily useful for logging purposes.

Parameters

description:String — a description of the target command

setDomain()method 
protected function setDomain(domain:ApplicationDomain):void

Sets the domain to use for reflecting on command classes.

Parameters

domain:ApplicationDomain — the domain to use for reflecting on command classes

setTarget()method 
protected function setTarget(target:Command):void

Sets the target command to execute.

Parameters

target:Command — the target command to execute

setTimeout()method 
protected function setTimeout(milliseconds:uint):void

Sets the timeout for this proxy. When the specified amount of time is elapsed the command execution will abort with an error.

Parameters

milliseconds:uint — the timeout for this proxy in milliseconds

setType()method 
protected function setType(type:Class):void

Sets the type of the command to execute. In this case the actual instance will be created by the proxy.

Parameters

type:Class — the type of the command to execute