Packagecom.threerings.util
Classpublic class ClassUtil

Class related utility methods.



Public Methods
 MethodDefined by
  
getClass(obj:Object):Class
[static]
ClassUtil
  
getClassByName(cname:String):Class
[static]
ClassUtil
  
getClassName(obj:Object):String
[static] Get the full class name, e.g.
ClassUtil
  
isAssignableAs(asClass:Class, srcClass:Class):Boolean
[static] Returns true if an object of type srcClass is a subclass of or implements the interface represented by the asClass paramter.
ClassUtil
  
isSameClass(obj1:Object, obj2:Object):Boolean
[static]
ClassUtil
  
newInstance(obj:Object):Object
[static] Return a new instance that is the same class as the specified object.
ClassUtil
  
shortClassName(obj:Object):String
[static] Get the class name with the last part of the package, e.g.
ClassUtil
  
tinyClassName(obj:Object):String
[static] Get just the class name, e.g.
ClassUtil
Method detail
getClass()method
public static function getClass(obj:Object):ClassParameters
obj:Object

Returns
Class
getClassByName()method 
public static function getClassByName(cname:String):ClassParameters
cname:String

Returns
Class
getClassName()method 
public static function getClassName(obj:Object):String

Get the full class name, e.g. "com.threerings.util.ClassUtil". Calling getClassName with a Class object will return the same value as calling it with an instance of that class. That is, getClassName(Foo) == getClassName(new Foo()).

Parameters
obj:Object

Returns
String
isAssignableAs()method 
public static function isAssignableAs(asClass:Class, srcClass:Class):Boolean

Returns true if an object of type srcClass is a subclass of or implements the interface represented by the asClass paramter. if (ClassUtil.isAssignableAs(Streamable, someClass)) { var s :Streamable = (new someClass() as Streamable);

Parameters
asClass:Class
 
srcClass:Class

Returns
Boolean
isSameClass()method 
public static function isSameClass(obj1:Object, obj2:Object):BooleanParameters
obj1:Object
 
obj2:Object

Returns
Boolean
newInstance()method 
public static function newInstance(obj:Object):Object

Return a new instance that is the same class as the specified object. The class must have a zero-arg constructor.

Parameters
obj:Object

Returns
Object
shortClassName()method 
public static function shortClassName(obj:Object):String

Get the class name with the last part of the package, e.g. "util.ClassUtil".

Parameters
obj:Object

Returns
String
tinyClassName()method 
public static function tinyClassName(obj:Object):String

Get just the class name, e.g. "ClassUtil".

Parameters
obj:Object

Returns
String