Reflect

class ReflectAvailable in flash, flash9, neko, js, php, cppThe Reflect API is a way to manipulate values dynamicly through an abstract interface in an untyped manner. Use with care. static inline function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : DynamicAvailable in flash, flash9, neko, jsCall a method with the given object and arguments. For example, to call the "foo" method with no arguments on the object "obj" use: Reflect.callMethod(obj, Reflect.field(obj, "foo"), []). static function callMethod( o : Dynamic, func : Dynamic, args : Array<Dynamic> ) : DynamicAvailable in php, cppCall a method with the given object and arguments. For example, to call the "foo" method with no arguments on the object "obj" use: Reflect.callMethod(obj, Reflect.field(obj, "foo"), []). static function compare<T>( a : T, b : T ) : IntAvailable in flash, flash9, js, php, cppGeneric comparison function, does not work for methods, see compareMethods. Can only be used with objects that implement __compare(other):Int method. Returns null if the parameters cannot be compared. static inline function compare<T>( a : T, b : T ) : IntAvailable in nekoGeneric comparison function, does not work for methods, see compareMethods. Can only be used with objects that implement __compare(other):Int method. Returns null if the parameters cannot be compared. static function compareMethods( f1 : Dynamic, f2 : Dynamic ) : BoolAvailable in flash, flash9, js, php, cppCompare two methods closures. Returns true if it's the same method of the same instance. static inline function compareMethods( f1 : Dynamic, f2 : Dynamic ) : BoolAvailable in nekoCompare two methods closures. Returns true if it's the same method of the same instance. static function copy<T>( o : T ) : TAvailable in flash, flash9, js, php, cppMake a copy of the fields of an object. Works with instances on neko. Only guaranteed to work with anonymous objects on other targets. static inline function copy<T>( o : T ) : TAvailable in nekoMake a copy of the fields of an object. Works with instances on neko. Only guaranteed to work with anonymous objects on other targets. static function deleteField( o : Dynamic, f : String ) : BoolAvailable in flash, flash9, js, php, cppDelete an object field. static inline function deleteField( o : Dynamic, f : String ) : BoolAvailable in nekoDelete an object field. static inline function field( o : Dynamic, field : String ) : DynamicAvailable in flash, flash9, neko, jsReturns the field of an object, or null if o is not an object or doesn't have this field. static function field( o : Dynamic, field : String ) : DynamicAvailable in php, cppReturns the field of an object, or null if o is not an object or doesn't have this field. static function fields( o : Dynamic ) : Array<String>Returns the list of field names of an object, excluding its methods. Note that this method is only guaranteed to work for anonymous objects. For class/instances fields see Type.getClassFields and Type.getInstanceFields methods. static inline function hasField( o : Dynamic, field : String ) : BoolAvailable in flash, phpTells if an object has a field set. This doesn't take into account the object's methods. static function hasField( o : Dynamic, field : String ) : BoolAvailable in flash9, neko, js, cppTells if an object has a field set. This doesn't take into account the object's methods. static function isFunction( f : Dynamic ) : BoolTells if a value is a function or not. static function isObject( v : Dynamic ) : BoolTells if a value is an object or not. static function makeVarArgs( f : Array<Dynamic> -> Dynamic ) : DynamicReturns a function equivalent to the given one but that takes any number of arguments instead of an array of arguments. static inline function setField( o : Dynamic, field : String, value : Dynamic ) : VoidSet an object field value.
version #9033, modified 2010-08-14 17:13:14 by api