Packagecom.asfusion.mate.actions.builders
Classpublic class AsyncMethodInvoker
InheritanceAsyncMethodInvoker Inheritance MethodInvoker Inheritance ObjectBuilder Inheritance BaseAction Inheritance AbstractAction
SubclassesAsyncCommandInvoker

AsyncMethodInvoker allows to calling an asynchronous function specified in the method attribute on the newly created EventDispatcher object or in the instance if that is provided. Because the method is asynchronous, we register to a success and falut events in this object and run the successHandlers or faultHandlers depending of the result. When you are making the asynchronous call, you can pass arguments to this function that come from a variety of sources, such as the event itself, a server result object, or any other value.Unless you specify cache="none", this AsyncMethodInvoker instance will be "cached" and not instantiated again. If you are using an instace we never generate the object and use the same instance.



Public Properties
 PropertyDefined by
 Inheritedarguments : *
The property arguments allows you to pass an Object or an Array of objects when calling the function defined in the property method .
MethodInvoker
 Inheritedcache : String
The cache attribute lets you specify whether this newly created object should be kept live so that the next time an instance of this class is requested, this already created object is returned instead.
ObjectBuilder
 InheritedconstructorArguments : *
The constructorArgs allows you to pass an Object or an Array of objects to the contructor when the instance is created.
ObjectBuilder
  debug : Boolean
Whether to show debugging information for its inner-handlerss.
AsyncMethodInvoker
  faultHandlers : Array
A set of inner-handlers to run when the call returns a fault.
AsyncMethodInvoker
  faultType : String
Event type that will be used to register to the fault event.
AsyncMethodInvoker
 Inheritedgenerator : Class
The generator attribute specifies what class should be instantiated.
ObjectBuilder
  innerHandlersClass : Class
Class that is used as a template to create the inner-handlers
AsyncMethodInvoker
  instance : IEventDispatcher
If this property is null, a new object instance is created on the prepare method.
AsyncMethodInvoker
 Inheritedmethod : String
The function to call on the created object.
MethodInvoker
 Inheritedproperties : Array
Properties allows you to add properties to the currentInstance.
BaseAction
 InheritedregisterTarget : Boolean
Registers the newly created object as an injector target.
ObjectBuilder
  successHandlers : Array
A set of inner-handlers to run when the call returns a success.
AsyncMethodInvoker
  successType : String
Event type that will be used to register to the success event.
AsyncMethodInvoker
Protected Properties
 PropertyDefined by
  currentIndex : int = 0
Index used to store groups of inner handlers.
AsyncMethodInvoker
 InheritedcurrentInstance : * = null
The currentInstance is the Object that this class will use and modify to do its work.
AbstractAction
 Inheriteddocument : Object
A reference to the document object associated with the IActionList that contains this action item.
AbstractAction
  innerHandlersList : Array
Inner handlers list that stores all inner handlers indexed by the currentIndex.
AsyncMethodInvoker
Public Methods
 MethodDefined by
 Inherited
initialized(document:Object, id:String):void
Called automatically by the MXML compiler if the AbstractAction is set up by using a tag.
AbstractAction
 Inherited
trigger(scope:IScope):void
This method gets called when the IActionList (ex: EventHandlers) is running.
AbstractAction
Protected Methods
 MethodDefined by
  
Handler that will be fired when the first of the innerHandlers starts executing.
AsyncMethodInvoker
 Inherited
complete(scope:IScope):void
The last method that trigger calls.
AbstractAction
  
createInnerHandlers(scope:IScope, innerType:String, actionList:Array, innerDispatcher:IEventDispatcher):IActionList
Creates IActionList and sets the properties: debug, type, listeners, dispatcher and inheritScope in the newly IActionList (inner-handlers).
AsyncMethodInvoker
 Inherited
createInstance(scope:IScope):Object
Where the currentInstance is created using the generator class as the template, passing arguments to the constructor as specified by the constructorArgs (if any).
ObjectBuilder
  
prepare(scope:IScope):void
The first method that trigger calls.
AsyncMethodInvoker
  
run(scope:IScope):void
Where all the action occurs.
AsyncMethodInvoker
 Inherited
setProperties(scope:IScope):void
Where all the properties are set into the currentInstance.
BaseAction
Property detail
currentIndexproperty
protected var currentIndex:int = 0

Index used to store groups of inner handlers.

debugproperty 
debug:Boolean  [read-write]

Whether to show debugging information for its inner-handlerss. If true, console output will show debugging information for all inner-handlers (resultHandlers and faultHandlers)

The default value is false.

Implementation
    public function get debug():Boolean
    public function set debug(value:Boolean):void
faultHandlersproperty 
faultHandlers:Array  [read-write]

A set of inner-handlers to run when the call returns a fault. Inside this inner-handlers, you can use the same tags you would in the main body of a IActionList, including service calls.

The default value is null.

Implementation
    public function get faultHandlers():Array
    public function set faultHandlers(value:Array):void
faultTypeproperty 
faultType:String  [read-write]

Event type that will be used to register to the fault event.

Implementation
    public function get faultType():String
    public function set faultType(value:String):void
innerHandlersClassproperty 
innerHandlersClass:Class  [read-write]

Class that is used as a template to create the inner-handlers

The default value is EventHandlers.

Implementation
    public function get innerHandlersClass():Class
    public function set innerHandlersClass(value:Class):void
innerHandlersListproperty 
protected var innerHandlersList:Array

Inner handlers list that stores all inner handlers indexed by the currentIndex.

instanceproperty 
instance:IEventDispatcher  [read-write]

If this property is null, a new object instance is created on the prepare method. Otherwise, this instance will be used. The class that will be used to create the instance if none is provided is the one specified in the generetor property.

The default value is null.

Implementation
    public function get instance():IEventDispatcher
    public function set instance(value:IEventDispatcher):void
successHandlersproperty 
successHandlers:Array  [read-write]

A set of inner-handlers to run when the call returns a success. Inside this inner-handlers, you can use the same tags you would in the main body of a IActionList, including service calls.

The default value is null.

Implementation
    public function get successHandlers():Array
    public function set successHandlers(value:Array):void
successTypeproperty 
successType:String  [read-write]

Event type that will be used to register to the success event.

Implementation
    public function get successType():String
    public function set successType(value:String):void
Method detail
actionListStartHandler()method
protected function actionListStartHandler(event:ActionListEvent):void

Handler that will be fired when the first of the innerHandlers starts executing.

Parameters
event:ActionListEvent
createInnerHandlers()method 
protected function createInnerHandlers(scope:IScope, innerType:String, actionList:Array, innerDispatcher:IEventDispatcher):IActionList

Creates IActionList and sets the properties: debug, type, listeners, dispatcher and inheritScope in the newly IActionList (inner-handlers).

Parameters
scope:IScope
 
innerType:String
 
actionList:Array
 
innerDispatcher:IEventDispatcher

Returns
IActionList
prepare()method 
protected override function prepare(scope:IScope):void

The first method that trigger calls. Usually, this is where the currentInstance is created or set if needed. In this method you can also perform any code that must be done first.

Parameters
scope:IScope
run()method 
protected override function run(scope:IScope):void

Where all the action occurs. At this moment, the currentInstance is already instantiated and all the properties are already set.

Parameters
scope:IScope