Class org.as2lib.env.reflect.MethodInfo

org.as2lib.core.BasicClass
   +--org.as2lib.env.reflect.MethodInfo

Implemented Interfaces

TypeMemberInfo

Description

MethodInfo represents a method.

MethodInfo instances for specific methods can be obtained using the ClassInfo#getMethods or ClassInfo#getMethod methods. That means you first have to get a class info for the class that declares or inherits the method. You can therefor use the ClassInfo#forObject, ClassInfo#forClass, ClassInfo#forInstance and ClassInfo#forName methods.

When you have obtained the method info you can use it to get information about the method. trace("Method name: " + methodInfo.getName()); trace("Declaring type: " + methodInfo.getDeclaringType().getFullName()); trace("Is Static?: " + methodInfo.isStatic());

Method Index

new MethodInfo()

getDeclaringType(), getFullName(), getMethod(), getName(), getStringifier(), invoke(), isStatic(), setStringifier(), snapshot(), toString()

Constructor Detail

MethodInfo

public function MethodInfo(name:String, declaringType:TypeInfo, staticFlag:Boolean, method:Function)

Constructs a new MethodInfo instance.

All arguments are allowed to be null. But keep in mind that not all methods will function properly if one is.

If method is not specified, it will be resolved at run-time everytime it is needed. This means that the concrete method will always be up-to-date even if you have overwritten it.

Parameters

namethe name of the method
declaringTypethe declaring type of the method
staticFlagdetermines whether the method is static
method(optional) the concrete method

Method Detail

getStringifier

static public function getStringifier(Void):Stringifier

Returns the stringifier used to stringify method infos.

If no custom stringifier has been set via the setStringifier method, a instance of the default MethodInfoStringifier class is returned.

Return

the stringifier that stringifies method infos

setStringifier

static public function setStringifier(methodInfoStringifier:MethodInfoStringifier):Void

Sets the stringifier used to stringify method infos.

If methodInfoStringifier is null or undefined getStringifier will return the default stringifier.

Parameters

methodInfoStringifierthe stringifier that stringifies method infos

getName

public function getName(Void):String

Returns the name of this method.

Return

the name of this method

getFullName

public function getFullName(Void):String

Returns the full name of this method.

The full name is the fully qualified name of the declaring type plus the name of this method.

Return

the full name of this method

Specified By

getFullName() in org.as2lib.env.reflect.TypeMemberInfo

getMethod

public function getMethod(Void):Function

Returns the concrete method this instance represents.

If the concrete method was not specified on construction it will be resolved on run-time by this method everytime asked for. The returned method is thus always the current method on the declaring type.

Return

the concrete method

getDeclaringType

public function getDeclaringType(Void):TypeInfo

Returns the type that declares this method.

Return

the type that declares this method

Specified By

getDeclaringType() in org.as2lib.env.reflect.TypeMemberInfo

invoke

public function invoke(scope, args:Array)

Invokes this method on the passed-in scope passing the given args.

The object referenced by this in this method is the object this method is invoked on, its / the passed-in scope.

Parameters

scopethe this-scope for the method invocation
argsthe arguments to pass-to the method on invocation

Return

the return value of the method invocation

isStatic

public function isStatic(Void):Boolean

Returns whether this method is static or not.

Static methods are methods per type.

Non-Static methods are methods per instance.

Return

true if this method is static else false

Specified By

isStatic() in org.as2lib.env.reflect.TypeMemberInfo

snapshot

public function snapshot(Void):MethodInfo

Returns a method info that reflects the current state of this method info.

Return

a snapshot of this method info

toString

public function toString():String

Returns the string representation of this method.

The string representation is obtained via the stringifier returned by the static getStringifier method.

Return

the string representation of this method

Specified By

toString() in org.as2lib.core.BasicInterface

Overrides

toString() in org.as2lib.core.BasicClass