class Class

Instances of this class are used to inspect Ferite classes

class contents [NB. Highlighted attributes are static members]
Functions
function classWithName(string) - Creates a new Class object
function constructor(void) - The constructor of the "Class" class
function fullyQualifiedName() - Find the fully qualified name of the wrapped class.
function getClass() - Get the class that the Class object wraps
function getFunction(string) - Creates a new Function object from a function in this class
function getFunctions() - Generates an array containing the static functions in this class
function getVariables() - Generates an array containing the static variables in this class
function locate(string) - Locate a class with a given name.
function name(void) - Get the path for a given class
function newObject(...) - Creates a new instance of the class associated with this object

Functions

static function classWithName Click to go up to the list
Creates a new Class object
Declaration:
    static function classWithName( string name )
Description:
This function is an alternate way to generate an object of the "Class" class. It differs from using "new" and passing the class to the constructor in that it takes the name of the class to associate with the object as a string instead of the class itself.
Parameters:
    Parameter #1: string name - The name of the class the object should be able to inspect
Returns:
    A "Class" object or null on failure
Example:

class TestClass { }
object wrapper = Class.classWithName("TestClass");


function constructor Click to go up to the list
The constructor of the "Class" class
Declaration:
    function constructor( void klass )
Description:
Objects of the "Class" class are initialised by passing the class they should be associated with to the constructor. The class name should not be a string (ie. don't quote the class name). The instantiation will fail if the argument is not a class.
Parameters:
    Parameter #1: void klass - The class which the object should be able to inspect
Example:

object wrapper = new Class(Regexp);


function fullyQualifiedName Click to go up to the list
Find the fully qualified name of the wrapped class.
Declaration:
    function fullyQualifiedName()
Returns:
    A string with the fully qualified name, such as "Stream.StdioStream".

function getClass Click to go up to the list
Get the class that the Class object wraps
Declaration:
    function getClass()
Returns:
    The class.

function getFunction Click to go up to the list
Creates a new Function object from a function in this class
Declaration:
    function getFunction( string name )
Description:
This function creates a new Function object which is associated with the specified method of the class associated with this "Class" object.
Parameters:
    Parameter #1: string name - The name of the method
Returns:
    A new Function object, or null on failure
Example:

class TestClass {
    number id;
    static function test( number n )
        .id = n;
}
object o = Class.classWithName("TestClass");
object f = o.getFunction('test');


function getFunctions Click to go up to the list
Generates an array containing the static functions in this class
Declaration:
    function getFunctions( )
Description:
This function returns an array of the static (class) functions which are contained in the class associated with this object. The array values are strings containing the names of the functions.
Returns:
    An array of the static functions in this class
Example:

class TestClass {
    static function f() {
    }
}
object wrapper = new Class(TestClass);
array func = wrapper.getFunctions(); » [ 'f' ]


function getVariables Click to go up to the list
Generates an array containing the static variables in this class
Declaration:
    function getVariables( )
Description:
This function returns an array of the static (class) variables which are contained in the class associated with this object. The array keys are the names of the variables, and the array values are the names of the types of the variables.
Returns:
    An array of the static variables in this class
Example:

class TestClass {
    static number id;
    static string name;
    static array keywords;
}
object wrapper = new Class(TestClass);
array variables = wrapper.getVariables(); » [ 'id' => 'number', 'name' => 'string', 'keywords' => 'array' ]


static function locate Click to go up to the list
Locate a class with a given name.
Declaration:
    static function locate( string name )
Description:
This is a particularily useful function for locating a named class, for example from a configuration file, so that it can later be instantiated.
Parameters:
    Parameter #1: string name - The path to the class.
Returns:
    The class. This can be passed to the constructor of Class
Example:

class TestClass {
    number id = 0;
    function constructor( number v )
        .id = v;
}
void klass = Class.locate("TestClass");
object obj = new klass(10);


static function name Click to go up to the list
Get the path for a given class
Declaration:
    static function name( void k )
Parameters:
    Parameter #1: void k - The class to obtain the name of.
Returns:
    A string containg the path to the class.
Example:

class TestClass {
}
void klass = Class.locate("TestClass");
string name = Class.name(klass);


function newObject Click to go up to the list
Creates a new instance of the class associated with this object
Declaration:
    static native function newObject( ... )
Description:
This function creates a new object, much like the "new" operator does, which is an instance of the class associated with this instance of the "Class" class.
Parameters:
    Parameter #1: ... The - arguments to pass to the constructor of the class
Returns:
    An instance of the class associated with this object or NULL on failure
Example:

class TestClass {
    number id = 0;
    function constructor( number v )
        .id = v;
}
object wrapper = Class.classWithName("TestClass");
object obj = wrapper.newObject(10);


Automatically generated at 12:07PM, Wednesday 25 May 2005 by feritedoc.