Packageorg.spicefactory.lib.command.light
Classpublic class LightCommandAdapter
InheritanceLightCommandAdapter Inheritance AbstractSuspendableCommand Inheritance AbstractCancellableCommand Inheritance AbstractAsyncCommand Inheritance flash.events.EventDispatcher
Implements CommandAdapter

A CommandAdapter that for commands that adhere to the conventions of Spicelib's "Light Commands".

Such a light command does not implement any of the Command interfaces. It has a required method called execute that may expect data to be passed to it through its method parameters. It supports an optional no-arg cancel method. For asynchronous operation it supports a callback function that is either passed to the execute method or injected into a public property called callback.



Public Properties
 PropertyDefined By
 Inheritedactive : Boolean
[read-only] Indicates whether this command is currently executing.
AbstractAsyncCommand
  cancellable : Boolean
[read-only] Indicates whether this executor can be cancelled.
LightCommandAdapter
  suspendable : Boolean
[read-only] Indicates whether this executor can be suspended.
LightCommandAdapter
 Inheritedsuspended : Boolean
[read-only] Indicates whether this command is currently suspended.
AbstractSuspendableCommand
  target : Object
[read-only] The target executed by this adapter.
LightCommandAdapter
Protected Properties
 PropertyDefined By
  data : CommandData
[read-only] The data associated with this executor.
LightCommandAdapter
  lifecycle : CommandLifecycle
[read-only] The lifecycle hook to use for the commands executed by this instance.
LightCommandAdapter
Public Methods
 MethodDefined By
  
LightCommandAdapter(target:Object, executeMethod:Method, callback:Property, cancelMethod:Method, resultMethod:Method, errorMethod:Method, async:Boolean)
Creates a new instance.
LightCommandAdapter
  
addErrorType(type:Class):void
[static] Adds a type of result that should be interpreted as an Error.
LightCommandAdapter
 Inherited
cancel():void
Cancels the command.
AbstractCancellableCommand
 Inherited
execute():void
Starts the execution of this command.
AbstractAsyncCommand
  
isErrorType(result:Object):Boolean
[static] Indicates whether the specified result value represents a known error type.
LightCommandAdapter
  
prepare(lifecycle:CommandLifecycle, data:CommandData):void
Method that may be called by frameworks before executing this command to hook into the lifecycle and data handling of this executor.
LightCommandAdapter
 Inherited
resume():void
Resumes the command.
AbstractSuspendableCommand
 Inherited
suspend():void
Suspends the command.
AbstractSuspendableCommand
Protected Methods
 MethodDefined By
 Inherited
complete(result:Object = null):void
Signals that this command has completed.
AbstractAsyncCommand
 Inherited
doCancel():void
Invoked when this command gets cancelled.
AbstractCancellableCommand
 Inherited
doExecute():void
Invoked when the command starts executing.
AbstractAsyncCommand
 Inherited
doResume():void
Invoked when this command gets resumed.
AbstractSuspendableCommand
 Inherited
doSuspend():void
Invoked when this command gets suspended.
AbstractSuspendableCommand
 Inherited
error(cause:Object = null):void
Signals an error condition and cancels the command.
AbstractAsyncCommand
Property Detail
cancellableproperty
cancellable:Boolean  [read-only]

Indicates whether this executor can be cancelled.

This property should be true when all currently active commands can be cancelled.


Implementation
    public function get cancellable():Boolean
dataproperty 
data:CommandData  [read-only]

The data associated with this executor. Contains any results from previously executed commands or data specified upfront.


Implementation
    protected function get data():CommandData
lifecycleproperty 
lifecycle:CommandLifecycle  [read-only]

The lifecycle hook to use for the commands executed by this instance.


Implementation
    protected function get lifecycle():CommandLifecycle
suspendableproperty 
suspendable:Boolean  [read-only]

Indicates whether this executor can be suspended.

This property should be true when all currently active commands can be suspended.


Implementation
    public function get suspendable():Boolean
targetproperty 
target:Object  [read-only]

The target executed by this adapter.


Implementation
    public function get target():Object
Constructor Detail
LightCommandAdapter()Constructor
public function LightCommandAdapter(target:Object, executeMethod:Method, callback:Property, cancelMethod:Method, resultMethod:Method, errorMethod:Method, async:Boolean)

Creates a new instance.

Parameters
target:Object — the target command instance
 
executeMethod:Method — the method to invoke when the command gets executed
 
callback:Property — the optional callback property to inject a callback function into
 
cancelMethod:Method — the optional cancel method to invoke whent the command gets cancelled
 
resultMethod:Method — flag indicating whether this command executes asynchronously
 
errorMethod:Method
 
async:Boolean
Method Detail
addErrorType()method
public static function addErrorType(type:Class):void

Adds a type of result that should be interpreted as an Error.

Parameters

type:Class — type of result that should be interpreted as an Error

isErrorType()method 
public static function isErrorType(result:Object):Boolean

Indicates whether the specified result value represents a known error type.

Parameters

result:Object — the result instance to check

Returns
Boolean — true if the specified result value represents a known error type
prepare()method 
public function prepare(lifecycle:CommandLifecycle, data:CommandData):void

Method that may be called by frameworks before executing this command to hook into the lifecycle and data handling of this executor.

Parameters

lifecycle:CommandLifecycle — the lifecycle hooks this executor should use
 
data:CommandData — data that can be passed to commands executed by this instance