Class org.as2lib.util.ClassUtil

org.as2lib.core.BasicClass
   +--org.as2lib.util.ClassUtil

Description

ClassUtil contains fundamental operations to efficiently and easily work with any class. All methods here are supposed to be used with functions treated as classes.

Method Index

createCleanInstance(), createInstance(), isImplementationOf(), isSubClassOf()

Inherited from BasicClass

toString()

Method Detail

isSubClassOf

static public function isSubClassOf(subClass:Function, superClass:Function):Boolean

Checks if the passed-in subClass is extended by the passed-in superClass.

Parameters

subClassthe class to check
superClassthe class to match

Return

true if subClass is a sub-class of superClass

isImplementationOf

static public function isImplementationOf(clazz:Function, interfaze:Function):Boolean

Checks if the passed-in clazz implements the passed-in

 interfaze
.

Parameters

clazzthe class to check
interfazethe interface the clazz may implement

Return

true if the passed-in clazz implements the passed-in interfaze else false

createCleanInstance

static public function createCleanInstance(clazz:Function):Object

Creates a new instance of the passed-in clazz without invoking its constructor.

Parameters

clazzthe class to create a new instance of

Return

new instance of the passed-in class.

createInstance

static public function createInstance(clazz:Function, args:Array)

Creates a new instance of the passed-in clazz applying the passed-in args to the constructor.

This util is mostly made for MTASC compatibility because it doesn't allow new clazz() for usual variables.

Parameters

clazzClass to be instanciated
argsArguments to be applied to the constructor

Return

new instance of the class