Packageorg.spicefactory.lib.command.builder
Classpublic class CommandGroupBuilder
InheritanceCommandGroupBuilder Inheritance AbstractCommandBuilder Inheritance Object

A builder DSL for creating CommandGroup instances.



Public Methods
 MethodDefined By
  
add(command:Object):CommandGroupBuilder
Adds a new command instance to this group.
CommandGroupBuilder
  
allResults(callback:Function):CommandGroupBuilder
Adds a callback to invoke when the command group completes successfully.
CommandGroupBuilder
  
[override] Builds the target command, applying all configurations specified through this builder instance.
CommandGroupBuilder
  
cancel(callback:Function):CommandGroupBuilder
Adds a callback to invoke when the command group gets cancelled.
CommandGroupBuilder
  
create(commandType:Class):CommandGroupBuilder
Adds a new command type to this group.
CommandGroupBuilder
  
Adds a value that can get passed to any command executed by the group this builder creates.
CommandGroupBuilder
  
description(description:String, ... params):CommandGroupBuilder
A description of the command group produced by this builder.
CommandGroupBuilder
  
domain(domain:ApplicationDomain):CommandGroupBuilder
The domain to use for reflecting on command classes.
CommandGroupBuilder
  
error(callback:Function):CommandGroupBuilder
Adds a callback to invoke when the command group produced an error.
CommandGroupBuilder
 Inherited
Builds and executes the target command.
AbstractCommandBuilder
  
lastResult(callback:Function):CommandGroupBuilder
Adds a callback to invoke when the command group completes successfully.
CommandGroupBuilder
  
Instructs the group to ignore cancellations of any of its commands and treat them the same way as successful completion.
CommandGroupBuilder
  
Instructs the group to ignore errors produced by any of its commands and treat them the same way as successful completion.
CommandGroupBuilder
  
timeout(milliseconds:uint):CommandGroupBuilder
Sets the timeout for the group.
CommandGroupBuilder
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):CommandGroupBuilder

Adds a new command instance to this group.

Parameters

command:Object — the command to add to this group

Returns
CommandGroupBuilder — this builder instance for method chaining
allResults()method 
public function allResults(callback:Function):CommandGroupBuilder

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

Parameters

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

Returns
CommandGroupBuilder — 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):CommandGroupBuilder

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

Parameters

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

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

Adds a new command type to this group.

Parameters

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

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

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

Parameters

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

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

A description of the command group produced by this builder.

Parameters

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

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

The domain to use for reflecting on command classes.

Parameters

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

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

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

Parameters

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

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

Adds a callback to invoke when the command group completes successfully. The result produced by the last command in the group will get passed to the callback. It is not recommended to use this callback in case of parallel execution as the type of result passed to the callback might be different for each execution.

Parameters

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

Returns
CommandGroupBuilder — this builder instance for method chaining
skipCancellations()method 
public function skipCancellations():CommandGroupBuilder

Instructs the group to ignore cancellations of any of its commands and treat them the same way as successful completion. Without invoking this method the entire group will get cancelled when any one command it executes gets cancelled.

Returns
CommandGroupBuilder — this builder instance for method chaining
skipErrors()method 
public function skipErrors():CommandGroupBuilder

Instructs the group to ignore errors produced by any of its commands and treat them the same way as successful completion. Without invoking this method the group will abort with an error when any one command it executes produces an error.

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

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

Parameters

milliseconds:uint — the timeout for this group in milliseconds

Returns
CommandGroupBuilder — this builder instance for method chaining