Packageorg.spicefactory.lib.command.builder
Classpublic class CommandProxyBuilder
InheritanceCommandProxyBuilder Inheritance AbstractCommandBuilder Inheritance Object

A builder DSL for creating CommandProxy instances, responsible for executing a single command.



Public Methods
 MethodDefined By
  
[override] Builds the target command, applying all configurations specified through this builder instance.
CommandProxyBuilder
  
cancel(callback:Function):CommandProxyBuilder
Adds a callback to invoke when the command gets cancelled.
CommandProxyBuilder
  
Adds a value that can get passed to the command executed by the proxy this builder creates.
CommandProxyBuilder
  
description(description:String, ... params):CommandProxyBuilder
A description of the command proxy produced by this builder.
CommandProxyBuilder
  
domain(domain:ApplicationDomain):CommandProxyBuilder
The domain to use for reflecting on command classes.
CommandProxyBuilder
  
error(callback:Function):CommandProxyBuilder
Adds a callback to invoke when the command produced an error.
CommandProxyBuilder
 Inherited
Builds and executes the target command.
AbstractCommandBuilder
  
result(callback:Function):CommandProxyBuilder
Adds a callback to invoke when the command completes successfully.
CommandProxyBuilder
  
timeout(milliseconds:uint):CommandProxyBuilder
Sets the timeout for the command execution.
CommandProxyBuilder
Protected Methods
 MethodDefined By
 Inherited
addCancelCallback(callback:Function):void
Adds a callback to invoke when the target command gets cancelled.
AbstractCommandBuilder
 Inherited
addData(value:Object):void
Adds a value that can get passed to any command executed by the command proxy this builder creates.
AbstractCommandBuilder
 Inherited
addErrorCallback(callback:Function):void
Adds a callback to invoke when the target command produced an error.
AbstractCommandBuilder
 Inherited
addResultCallback(callback:Function):void
Adds a callback to invoke when the target command completes successfully.
AbstractCommandBuilder
 Inherited
asCommand(command:Object):Command
Turns the specified instance into a command that can be executed by the proxy created by this builder.
AbstractCommandBuilder
 Inherited
setDescription(description:String):void
Sets a description of the target command.
AbstractCommandBuilder
 Inherited
setDomain(domain:ApplicationDomain):void
Sets the domain to use for reflecting on command classes.
AbstractCommandBuilder
 Inherited
setTarget(target:Command):void
Sets the target command to execute.
AbstractCommandBuilder
 Inherited
setTimeout(milliseconds:uint):void
Sets the timeout for this proxy.
AbstractCommandBuilder
 Inherited
setType(type:Class):void
Sets the type of the command to execute.
AbstractCommandBuilder
Method Detail
build()method
override 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
cancel()method 
public function cancel(callback:Function):CommandProxyBuilder

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

Parameters

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

Returns
CommandProxyBuilder — this builder instance for method chaining
data()method 
public function data(value:Object):CommandProxyBuilder

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

Parameters

value:Object — the value to pass to the command

Returns
CommandProxyBuilder — this builder instance for method chaining
description()method 
public function description(description:String, ... params):CommandProxyBuilder

A description of the command proxy produced by this builder.

Parameters

description:String — a description of the command proxy produced by this builder
 
... params — parameters to insert into the description in case in contains placeholders (like {0})

Returns
CommandProxyBuilder — this builder instance for method chaining
domain()method 
public function domain(domain:ApplicationDomain):CommandProxyBuilder

The domain to use for reflecting on command classes.

Parameters

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

Returns
CommandProxyBuilder — this builder instance for method chaining
error()method 
public function error(callback:Function):CommandProxyBuilder

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

Parameters

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

Returns
CommandProxyBuilder — this builder instance for method chaining
result()method 
public function result(callback:Function):CommandProxyBuilder

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

Parameters

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

Returns
CommandProxyBuilder — this builder instance for method chaining
timeout()method 
public function timeout(milliseconds:uint):CommandProxyBuilder

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

Parameters

milliseconds:uint — the timeout for the command execution in milliseconds

Returns
CommandProxyBuilder — this builder instance for method chaining