Packageimpression.utilities
Classpublic class ObjectUtils
InheritanceObjectUtils Inheritance Object

The ObjectUtils class contains utility functions for objects.



Public Methods
 MethodDefined By
  
classOf(item:*):Class
[static] Returns the class definition of an item.
ObjectUtils
  
clone(source:Object):*
[static] Returns an exact copy of the source.
ObjectUtils
  
newInstanceOf(item:*):*
[static] Returns a new object of the type specified by item.
ObjectUtils
  
tryCast(item:*, type:Class):*
[static] Returns an item cast to a specific class, or null if the item cannot be cast to the specified class.
ObjectUtils
Method Detail
classOf()method
public static function classOf(item:*):Class

Returns the class definition of an item.

Parameters

item:* — An expression to find the class definition of. item can be one of the following types:
  • String. If the empty string ("") is passed, the method returns null; otherwise, the method returns the result of invoking getDefinitionByName() with item.
  • [other types]. The method returns the result of invoking getDefinitionByName() with the result of invoking getQualifiedClassName() with item.

Returns
Class — The class defintion of the item, or null if an error occurred or an empty string was passed.

See also

flash.utils.getQualifiedClassName()
flash.utils.getDefinitionByName()
clone()method 
public static function clone(source:Object):*

Returns an exact copy of the source.

This method writes the object to a ByteArray, then reads the result as a new object and returns it.

Parameters

source:Object — The object to return a copy of.

Returns
* — A copy of source.

See also

flash.utils.ByteArray.writeObject()
flash.utils.ByteArray.readObject()
newInstanceOf()method 
public static function newInstanceOf(item:*):*

Returns a new object of the type specified by item.

item can be a Class reference, an instance of an object, or a String containing the name of the class to create.

Parameters

item:* — The type of object to create.

Returns
* — A new object of the type specified by item.

See also

tryCast()method 
public static function tryCast(item:*, type:Class):*

Returns an item cast to a specific class, or null if the item cannot be cast to the specified class.

Parameters

item:* — Item to cast.
 
type:Class — Class to cast item to.

Returns
*item cast as type, or null if the item cannot be cast to type.