Package | com.asfusion.mate.actions.builders |
Class | public class AsyncMethodInvoker |
Inheritance | AsyncMethodInvoker MethodInvoker ObjectBuilder BaseAction AbstractAction |
Subclasses | AsyncCommandInvoker |
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.
Property | Defined by | ||
---|---|---|---|
arguments : *
The property
arguments allows you to pass an Object or an Array of objects when calling
the function defined in the property method . | MethodInvoker | ||
cache : 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 | ||
constructorArguments : *
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 | ||
generator : 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 | ||
method : String
The function to call on the created object.
| MethodInvoker | ||
properties : ArrayProperties allows you to add properties to the currentInstance . | BaseAction | ||
registerTarget : 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 |
Property | Defined by | ||
---|---|---|---|
currentIndex : int = 0
Index used to store groups of inner handlers.
| AsyncMethodInvoker | ||
currentInstance : * = null
The
currentInstance is the Object that this class will
use and modify to do its work. | AbstractAction | ||
document : 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 |
Method | Defined by | ||
---|---|---|---|
actionListStartHandler(event:ActionListEvent):void
Handler that will be fired when the first of the innerHandlers starts executing.
| AsyncMethodInvoker | ||
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 | ||
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 | ||
The first method that
trigger calls. | AsyncMethodInvoker | ||
Where all the action occurs.
| AsyncMethodInvoker | ||
setProperties(scope:IScope):void
Where all the properties are set into the
currentInstance . | BaseAction |
currentIndex | property |
protected var currentIndex:int = 0
Index used to store groups of inner handlers.
debug | property |
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
.
public function get debug():Boolean
public function set debug(value:Boolean):void
faultHandlers | property |
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
.
public function get faultHandlers():Array
public function set faultHandlers(value:Array):void
faultType | property |
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
innerHandlersClass | property |
innerHandlersClass:Class
[read-write]Class that is used as a template to create the inner-handlers
The default value is EventHandlers
.
public function get innerHandlersClass():Class
public function set innerHandlersClass(value:Class):void
innerHandlersList | property |
protected var innerHandlersList:Array
Inner handlers list that stores all inner handlers indexed by the currentIndex.
instance | property |
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
.
public function get instance():IEventDispatcher
public function set instance(value:IEventDispatcher):void
successHandlers | property |
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
.
public function get successHandlers():Array
public function set successHandlers(value:Array):void
successType | property |
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
actionListStartHandler | () | method |
protected function actionListStartHandler(event:ActionListEvent):void
Handler that will be fired when the first of the innerHandlers starts executing.
Parametersevent: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).
Parametersscope:IScope |
|
innerType:String |
|
actionList:Array |
|
innerDispatcher:IEventDispatcher |
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.
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.
scope:IScope |