haXe

Runtime Type Informations

Runtime type informations are useful if you need at Runtime to know the exact way your classes were declared in your code.

In order to have these extra informations accessible, you simply need to have your classes implements haxe.rtti.Infos. These informations are stored in an hidden __rtti static field and can be parser into Xml to be processed using the haxe.rtti API :

class Test implements haxe.rtti.Infos {
    var v : String;
    static function f() {
        return 33;
    }
    static function main() {
        var rtti : String = untyped Test.__rtti;
        var x = Xml.parse(rtti).firstElement();
        var infos = new haxe.rtti.XmlParser().processElement(x);
        trace(infos);
    }
}

See the XmlParser API for more informations.

version #1073, modified 2008-05-03 00:20:46 by ncannasse