org.as2lib.core.BasicClass +--org.as2lib.env.reflect.MethodInfo
TypeMemberInfo
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());
new 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.
name | the name of the method |
declaringType | the declaring type of the method |
staticFlag | determines whether the method is static |
method | (optional) the concrete method |
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.
the stringifier that stringifies method infos
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.
methodInfoStringifier | the stringifier that stringifies method infos |
public function getName(Void):String
Returns the name of this method.
the name of this method
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.
the full name of this method
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.
the concrete method
public function getDeclaringType(Void):TypeInfo
Returns the type that declares this method.
the type that declares this method
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
.
scope | the this -scope for the method invocation
|
args | the arguments to pass-to the method on invocation |
the return value of the method invocation
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.
true
if this method is static else false
public function snapshot(Void):MethodInfo
Returns a method info that reflects the current state of this method info.
a snapshot of this method info
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.
the string representation of this method
toString() in org.as2lib.core.BasicInterface