org.as2lib.core.BasicClass +--org.as2lib.util.ObjectUtil
ObjectUtil
contains fundamental methods to efficiently and easily work
with any type of object.
static public TYPE_STRING:String
static public TYPE_NUMBER:String
static public TYPE_OBJECT:String
static public TYPE_BOOLEAN:String
static public TYPE_MOVIECLIP:String
static public TYPE_FUNCTION:String
static public TYPE_UNDEFINED:String
static public TYPE_NULL:String
static public function stringify(object):String
Stringifies the passed-in object
using the stringifier returned by the
static Config.getObjectStringifier method.
object | the object to stringify |
the string representation of the passed-in object
static public function typesMatch(object, type:Function):Boolean
Checks if the type of the passed-in object
matches the passed-in
type
.
Every value (even null
and undefined
) matches type
Object
.
Instances as well as their primitive correspondent match the types
String
, Number
or Boolean
.
object | the object whose type to compare with the passed-in type
|
type | the type to use for the comparison |
true
if the type of the object
matches the passed-in
type
else false
static public function compareTypeOf(firstObject, secondObject):Boolean
Compares the results of an execution of the typeof
method applied to
both passed-in objects.
firstObject | the first object of the comparison |
secondObject | the second object of the comparison |
true
if the execution of the typeof
method returns the
same else false
static public function isPrimitiveType(object):Boolean
Checks if the passed-in object
is a primitive type.
Primitive types are strings, numbers and booleans that are not created via the
new operator. For example "myString"
, 3
and true
are
primitive types, but new String("myString")
, new Number(3)
and
new Boolean(true)
are not.
object | the object to check whether it is a prmitive type |
true
if object
is a primitive type else false
static public function isTypeOf(object, type:String):Boolean
Checks if the result of an execution of the typeof
method on the
passed-in object
matches the passed-in type
.
All possible types are available as constants.
object | the object whose type to check |
type | the string representation of the type |
true
if the object is of the given type
static public function isInstanceOf(object, type:Function):Boolean
Checks if the passed-in object
is an instance of the passed-in
type
.
If the passed-in type
is Object
, true
will always be
returned, because every object is an instance of Object
, even null
and undefined
.
object | the object to check |
type | the type to check whether the object is an instance of
|
true
if the passed-in object
is an instance of the given
type
else false
static public function isExplicitInstanceOf(object, clazz:Function):Boolean
Checks if the passed-in object
is an explicit instance of the passed-in
clazz
.
That means that true
will only be returned if the object was instantiated
directly from the given clazz
.
object | the object to check whether it is an explicit instance of clazz
|
clazz | the class to use as the basis for the check |
true
if the object is an explicit instance of clazz
else
false