Class org.as2lib.app.exec.Call

org.as2lib.core.BasicClass
   +--org.as2lib.app.exec.Call

Implemented Interfaces

ForEachExecutable

Description

Call enables another object to call a method in another scope without having to know the scope.

This enables you to pass a call to another object and let the object execute the call without losing its scope. You use the execute method to do so.

Method Index

new Call()

execute(), forEach(), toString()

Constructor Detail

Call

public function Call(object, method:Function)

Constructs a new Call instance.

Parameters

objectthe object to execute the method on
methodthe method to execute

Throws

IllegalArgumentExceptionif either object or method is null or undefined

Method Detail

execute

public function execute()

Executes the method on the object passing the given arguments and returns the result of the execution.

Return

the result of the method execution

forEach

public function forEach(object):Array

Iterates over the passed-in object using the for..in loop and executes this call passing the found member, its name and the passed-in object.

Example: class MyClass { private var a:String; private var b:String; private var c:String; public function MyClass() { a = "1"; b = "2"; c = "2"; } public function traceObject(value, name:String, inObject):Void { trace(name + ": " + value); } public function listAll() { new Call(this, traceObject).forEach(this); } }

Note that only members visible to for..in loops cause the execute method to be invoked.

Parameters

objectthe object to iterate over

Specified By

forEach() in org.as2lib.app.exec.ForEachExecutable

toString

public function toString():String

Returns the string representation of this call.

Return

the string representation of this call

Specified By

toString() in org.as2lib.core.BasicInterface

Overrides

toString() in org.as2lib.core.BasicClass