Packageorg.spicefactory.lib.command.builder
Classpublic class CommandFlowBuilder
InheritanceCommandFlowBuilder Inheritance AbstractCommandBuilder Inheritance Object

A builder DSL for creating CommandFlow instances.



Public Methods
 MethodDefined By
  
add(command:Object):CommandLinkBuilder
Adds a new command instance to this flow.
CommandFlowBuilder
  
allResults(callback:Function):CommandFlowBuilder
Adds a callback to invoke when the command flow completes successfully.
CommandFlowBuilder
  
[override] Builds the target command, applying all configurations specified through this builder instance.
CommandFlowBuilder
  
cancel(callback:Function):CommandFlowBuilder
Adds a callback to invoke when the command flow gets cancelled.
CommandFlowBuilder
  
create(commandType:Class):CommandLinkBuilder
Adds a new command type to this flow.
CommandFlowBuilder
  
data(value:Object):CommandFlowBuilder
Adds a value that can get passed to any command executed by the flow this builder creates.
CommandFlowBuilder
  
Returns a builder to use for specifying the default link in case a command result is not processed by any of the explicit links specified for that command.
CommandFlowBuilder
  
description(description:String, ... params):CommandFlowBuilder
A description of the command flow produced by this builder.
CommandFlowBuilder
  
domain(domain:ApplicationDomain):CommandFlowBuilder
The domain to use for reflecting on command classes.
CommandFlowBuilder
  
error(callback:Function):CommandFlowBuilder
Adds a callback to invoke when the command flow produced an error.
CommandFlowBuilder
 Inherited
Builds and executes the target command.
AbstractCommandBuilder
  
lastResult(callback:Function):CommandFlowBuilder
Adds a callback to invoke when the command flow completes successfully.
CommandFlowBuilder
  
timeout(milliseconds:uint):CommandFlowBuilder
Sets the timeout for the flow.
CommandFlowBuilder
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
add()method
public function add(command:Object):CommandLinkBuilder

Adds a new command instance to this flow.

Parameters

command:Object — the command to add to this flow

Returns
CommandLinkBuilder — a builder to specify links for this command
allResults()method 
public function allResults(callback:Function):CommandFlowBuilder

Adds a callback to invoke when the command flow completes successfully. An instance of CommandResult will get passed to the callback holding all results produced by the commands in the flow.

Parameters

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

Returns
CommandFlowBuilder — this builder instance for method chaining
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):CommandFlowBuilder

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

Parameters

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

Returns
CommandFlowBuilder — this builder instance for method chaining
create()method 
public function create(commandType:Class):CommandLinkBuilder

Adds a new command type to this flow.

Parameters

commandType:Class — the command type to add to this flow

Returns
CommandLinkBuilder — a builder to specify links for this command type
data()method 
public function data(value:Object):CommandFlowBuilder

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

Parameters

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

Returns
CommandFlowBuilder — this builder instance for method chaining
defaultLink()method 
public function defaultLink():DefaultLinkBuilder

Returns a builder to use for specifying the default link in case a command result is not processed by any of the explicit links specified for that command.

Returns
DefaultLinkBuilder — a builder to use for specifying the default link
description()method 
public function description(description:String, ... params):CommandFlowBuilder

A description of the command flow produced by this builder.

Parameters

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

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

The domain to use for reflecting on command classes.

Parameters

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

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

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

Parameters

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

Returns
CommandFlowBuilder — this builder instance for method chaining
lastResult()method 
public function lastResult(callback:Function):CommandFlowBuilder

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

Parameters

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

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

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

Parameters

milliseconds:uint — the timeout for this flow in milliseconds

Returns
CommandFlowBuilder — this builder instance for method chaining