org.as2lib.core.BasicClass +--org.as2lib.env.reflect.ReflectUtil
ReflectUtil
obtains simple information about members.
It is independent on any module of the As2lib. And thus does not include them and does not dramatically increase the file size.
static public CONSTRUCTOR:String
static public UNKNOWN:String
static public function getUnusedMemberName(object):String
Searches for a member name that is currently not used.
Uses MEMBER_PREFIX and a number from 1 to 10000 with two variants to find a member name that is currently not used (20.000 possible variants).
object | the object to find an unused member name in |
the name of the unused member or null
if all names are already
reserved
static public function getTypeAndMethodInfoByType(type:Function, method:Function):Array
Returns an array that contains the passed-in method
's scope, the name
of the type that declares the method and the name of the method itself.
The type that declares the method
must not be the passed-in type
.
It may also be a super-type of the passed-in type
.
null
will be returned if the passed-in type
is null
.
type | the type to start the search for the method |
method | the method to return information about |
an array containing the passed-in method
's scope, the name of
the declaring type and the passed-in method
's name
static public function getTypeAndMethodInfoByInstance(instance, method:Function):Array
Returns an array that contains the passed-in method
's scope, the name
of the type that declares the method and the name of the method itself.
The type that declares the method
must not be the direct type of the
passed-in instance
. It may also be a super-type of this type.
null
will be returned if the passed-in type
is null
.
instance | the instance of the type to start the search for the method |
method | the method to return information about |
an array containing the passed-in method
's scope, the name of
the declaring type and the passed-in method
's name
static public function getTypeAndMethodInfoByPrototype(p, m:Function):Array
Returns an array that contains the passed-in method's m
scope, the name
of the type that declares the method and the name of the method itself.
The type that declares the method must not be the direct type of the
passed-in prototype p
. It may also be a super-type of this type.
null
will be returned if the passed-in prototype is null
.
p | the beginning of the prototype chain to search through |
m | the method to return information about |
an array containing the passed-in method's scope, the name of the declaring type and the passed-in method's name
static public function getTypeNameForInstance(instance):String
Returns the name of the type, the passed-in object is an instance of.
null
will be returned if:
instance
is null
or undefined
. _global
.instance | the instance of the type to return the name of |
the name of the type of the instance or null
static public function getTypeNameForType(type:Function):String
Returns the name of the passed-in type
.
null
will be returned if:
type
is null
or undefined
. type
could not be found in _global
.type | the type to return the name of |
the name of the passed-in type
or null
static public function getMethodNameByInstance(method:Function, instance):String
Returns the name of the method
on the instance's type
.
null
will be returned if:
method
or instance
are null
method
does not exist on the instance
's type.method | the method to get the name of |
instance | the instance whose type implements the method
|
the name of the method
or null
static public function getMethodNameByType(method:Function, type:Function):String
Returns the name of the method
on the type
.
null
will be returned if:
method
or type
are null
method
does not exist on the type
.method | the method to get the name of |
type | the type that implements the method
|
the name of the method
or null
static public function isMethodStaticByInstance(methodName:String, instance):Boolean
Returns whether the method with the passed-in methodName
is static, that
means a per type method.
false
will always be returned if the passed-in methodName
is
null
or an empty string or if the passed-in instance
is null
.
methodName | the name of the method to check whether it is static |
instance | the instance of the type that implements the method |
true
if the method is static else false
static public function isMethodStaticByType(methodName:String, type:Function):Boolean
Returns whether the method with the passed-in methodName
is static, that
means a per type method.
false
will always be returned if the passed-in methodName
is
null
or an empty string or if the passed-in type
is null
.
methodName | the name of the method to check whether it is static |
type | the type that implements the method |
true
if the method is static else false
static public function isConstructorByInstance(method:Function, instance):Boolean
Returns whether the passed-in method
is the constructor of the passed-in
instance
.
false
will always be returned if the passed-in method
is
null
or if the passed-in instance
is null
.
method | the method to check whether it is the constructor of the passed-in
instance
|
instance | the instance that might be instantiated by the passed-in method
|
true
if method
is the constructor of instance
else false
static public function isConstructorByType(method:Function, type:Function):Boolean
Returns whether the passed-in method
is the constructor of the passed-in
type
.
Note that in Flash the constructor is the same as the type.
false
will always be returned if the passed-in method
is
null
or if the passed-in type
is null
.
method | the method to check whether it is the constructor of the passed-in
type
|
type | the type that might declare the passed-in method as constructor
|
true
if method
is the constructor of type
else
false
static public function getVariableNames(instance):Array
Returns an array that contains the names of the variables of the passed-in
instance
as String
s.
The resulting array contains all variables' names even those hidden from
for..in loops. Excluded are only "__proto__"
, "prototype"
,
"__constructor__"
and "constructor"
and members that are of
type "function"
.
Note that it is not possible to get variables that have been declared in the class but have not been initialized yet. These variables' names are thus not contained in the resulting array.
This method will never return null
. If the passed-in instance
has no variables an empty array will be returned.
instance | the instance whose varaibles to return |
all initialized variables of the passed-in instance