|
@@ -36,7 +36,7 @@ enum ValueType {
|
|
|
|
|
|
/**
|
|
/**
|
|
The haxe Reflection API allows retrieval of type information at runtime.
|
|
The haxe Reflection API allows retrieval of type information at runtime.
|
|
-
|
|
|
|
|
|
+
|
|
This class complements the more lightweight Reflect class, with a focus on
|
|
This class complements the more lightweight Reflect class, with a focus on
|
|
class and enum instances.
|
|
class and enum instances.
|
|
**/
|
|
**/
|
|
@@ -44,21 +44,21 @@ extern class Type {
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the class of `o`, if `o` is a class instance.
|
|
Returns the class of `o`, if `o` is a class instance.
|
|
-
|
|
|
|
|
|
+
|
|
If `o` is null or of a different type, null is returned.
|
|
If `o` is null or of a different type, null is returned.
|
|
-
|
|
|
|
|
|
+
|
|
In general, type parameter information cannot be obtained at runtime.
|
|
In general, type parameter information cannot be obtained at runtime.
|
|
**/
|
|
**/
|
|
public static function getClass<T>( o : T ) : Class<T>;
|
|
public static function getClass<T>( o : T ) : Class<T>;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the enum of enum instance `o`.
|
|
Returns the enum of enum instance `o`.
|
|
-
|
|
|
|
|
|
+
|
|
An enum instance is the result of using an enum constructor. Given an
|
|
An enum instance is the result of using an enum constructor. Given an
|
|
`enum Color { Red; }`, `getEnum(Red)` returns `Enum<Color>`.
|
|
`enum Color { Red; }`, `getEnum(Red)` returns `Enum<Color>`.
|
|
-
|
|
|
|
|
|
+
|
|
If `o` is null, null is returned.
|
|
If `o` is null, null is returned.
|
|
-
|
|
|
|
|
|
+
|
|
In general, type parameter information cannot be obtained at runtime.
|
|
In general, type parameter information cannot be obtained at runtime.
|
|
**/
|
|
**/
|
|
public static function getEnum( o : EnumValue ) : Enum<Dynamic>;
|
|
public static function getEnum( o : EnumValue ) : Enum<Dynamic>;
|
|
@@ -66,11 +66,11 @@ extern class Type {
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the super-class of class `c`.
|
|
Returns the super-class of class `c`.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` has no super class, null is returned.
|
|
If `c` has no super class, null is returned.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` is null, the result is unspecified.
|
|
If `c` is null, the result is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
In general, type parameter information cannot be obtained at runtime.
|
|
In general, type parameter information cannot be obtained at runtime.
|
|
**/
|
|
**/
|
|
public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic>;
|
|
public static function getSuperClass( c : Class<Dynamic> ) : Class<Dynamic>;
|
|
@@ -78,63 +78,63 @@ extern class Type {
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the name of class `c`, including its path.
|
|
Returns the name of class `c`, including its path.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` is inside a package, the package structure is returned dot-
|
|
If `c` is inside a package, the package structure is returned dot-
|
|
separated, with another dot separating the class name:
|
|
separated, with another dot separating the class name:
|
|
`pack1.pack2.(...).packN.ClassName`
|
|
`pack1.pack2.(...).packN.ClassName`
|
|
If `c` is a sub-type of a haxe module, that module is not part of the
|
|
If `c` is a sub-type of a haxe module, that module is not part of the
|
|
package structure.
|
|
package structure.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` has no package, the class name is returned.
|
|
If `c` has no package, the class name is returned.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` is null, the result is unspecified.
|
|
If `c` is null, the result is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
The class name does not include any type parameters.
|
|
The class name does not include any type parameters.
|
|
**/
|
|
**/
|
|
public static function getClassName( c : Class<Dynamic> ) : String;
|
|
public static function getClassName( c : Class<Dynamic> ) : String;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the name of enum `e`, including its path.
|
|
Returns the name of enum `e`, including its path.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` is inside a package, the package structure is returned dot-
|
|
If `e` is inside a package, the package structure is returned dot-
|
|
separated, with another dot separating the enum name:
|
|
separated, with another dot separating the enum name:
|
|
`pack1.pack2.(...).packN.EnumName`
|
|
`pack1.pack2.(...).packN.EnumName`
|
|
If `e` is a sub-type of a haxe module, that module is not part of the
|
|
If `e` is a sub-type of a haxe module, that module is not part of the
|
|
package structure.
|
|
package structure.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` has no package, the enum name is returned.
|
|
If `e` has no package, the enum name is returned.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` is null, the result is unspecified.
|
|
If `e` is null, the result is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
The enum name does not include any type parameters.
|
|
The enum name does not include any type parameters.
|
|
**/
|
|
**/
|
|
public static function getEnumName( e : Enum<Dynamic> ) : String;
|
|
public static function getEnumName( e : Enum<Dynamic> ) : String;
|
|
|
|
|
|
/**
|
|
/**
|
|
Resolves a class by name.
|
|
Resolves a class by name.
|
|
-
|
|
|
|
|
|
+
|
|
If `name` is the path of an existing class, that class is returned.
|
|
If `name` is the path of an existing class, that class is returned.
|
|
-
|
|
|
|
|
|
+
|
|
Otherwise null is returned.
|
|
Otherwise null is returned.
|
|
-
|
|
|
|
|
|
+
|
|
If `name` is null or the path to a different type, the result is
|
|
If `name` is null or the path to a different type, the result is
|
|
unspecified.
|
|
unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
The class name must not include any type parameters.
|
|
The class name must not include any type parameters.
|
|
**/
|
|
**/
|
|
public static function resolveClass( name : String ) : Class<Dynamic>;
|
|
public static function resolveClass( name : String ) : Class<Dynamic>;
|
|
|
|
|
|
/**
|
|
/**
|
|
Resolves an enum by name.
|
|
Resolves an enum by name.
|
|
-
|
|
|
|
|
|
+
|
|
If `name` is the path of an existing enum, that enum is returned.
|
|
If `name` is the path of an existing enum, that enum is returned.
|
|
-
|
|
|
|
|
|
+
|
|
Otherwise null is returned.
|
|
Otherwise null is returned.
|
|
-
|
|
|
|
|
|
+
|
|
If `name` is null the result is unspecified.
|
|
If `name` is null the result is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
If `name` is the path to a different type, null is returned.
|
|
If `name` is the path to a different type, null is returned.
|
|
-
|
|
|
|
|
|
+
|
|
The enum name must not include any type parameters.
|
|
The enum name must not include any type parameters.
|
|
**/
|
|
**/
|
|
public static function resolveEnum( name : String ) : Enum<Dynamic>;
|
|
public static function resolveEnum( name : String ) : Enum<Dynamic>;
|
|
@@ -142,27 +142,27 @@ extern class Type {
|
|
/**
|
|
/**
|
|
Creates an instance of class `cl`, using `args` as arguments to the
|
|
Creates an instance of class `cl`, using `args` as arguments to the
|
|
class constructor.
|
|
class constructor.
|
|
-
|
|
|
|
|
|
+
|
|
This function guarantees that the class constructor is called.
|
|
This function guarantees that the class constructor is called.
|
|
-
|
|
|
|
|
|
+
|
|
Default values of constructors arguments are not guaranteed to be
|
|
Default values of constructors arguments are not guaranteed to be
|
|
taken into account.
|
|
taken into account.
|
|
-
|
|
|
|
|
|
+
|
|
If `cl` or `args` are null, or if the number of elements in `args` does
|
|
If `cl` or `args` are null, or if the number of elements in `args` does
|
|
not match the expected number of constructor arguments, or if any
|
|
not match the expected number of constructor arguments, or if any
|
|
argument has an invalid type, or if `cl` has no own constructor, the
|
|
argument has an invalid type, or if `cl` has no own constructor, the
|
|
result is unspecified.
|
|
result is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
In particular, default values of constructor arguments are not
|
|
In particular, default values of constructor arguments are not
|
|
guaranteed to be taken into account.
|
|
guaranteed to be taken into account.
|
|
**/
|
|
**/
|
|
public static function createInstance<T>( cl : Class<T>, args : Array<Dynamic> ) : T;
|
|
public static function createInstance<T>( cl : Class<T>, args : Array<Dynamic> ) : T;
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
Creates an instance of class `cl`.
|
|
Creates an instance of class `cl`.
|
|
-
|
|
|
|
|
|
+
|
|
This function guarantees that the class constructor is not called.
|
|
This function guarantees that the class constructor is not called.
|
|
-
|
|
|
|
|
|
+
|
|
If `cl` is null, the result is unspecified.
|
|
If `cl` is null, the result is unspecified.
|
|
**/
|
|
**/
|
|
public static function createEmptyInstance<T>( cl : Class<T> ) : T;
|
|
public static function createEmptyInstance<T>( cl : Class<T> ) : T;
|
|
@@ -170,7 +170,7 @@ extern class Type {
|
|
/**
|
|
/**
|
|
Creates an instance of enum `e` by calling its constructor `constr` with
|
|
Creates an instance of enum `e` by calling its constructor `constr` with
|
|
arguments `params`.
|
|
arguments `params`.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` or `constr` is null, or if enum `e` has no constructor named
|
|
If `e` or `constr` is null, or if enum `e` has no constructor named
|
|
`constr`, or if the number of elements in `params` does not match the
|
|
`constr`, or if the number of elements in `params` does not match the
|
|
expected number of constructor arguments, or if any argument has an
|
|
expected number of constructor arguments, or if any argument has an
|
|
@@ -181,10 +181,10 @@ extern class Type {
|
|
/**
|
|
/**
|
|
Creates an instance of enum `e` by calling its constructor number
|
|
Creates an instance of enum `e` by calling its constructor number
|
|
`index` with arguments `params`.
|
|
`index` with arguments `params`.
|
|
-
|
|
|
|
|
|
+
|
|
The constructor indices are preserved from haxe syntax, so the first
|
|
The constructor indices are preserved from haxe syntax, so the first
|
|
declared is index 0, the next index 1 etc.
|
|
declared is index 0, the next index 1 etc.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` or `constr` is null, or if enum `e` has no constructor named
|
|
If `e` or `constr` is null, or if enum `e` has no constructor named
|
|
`constr`, or if the number of elements in `params` does not match the
|
|
`constr`, or if the number of elements in `params` does not match the
|
|
expected number of constructor arguments, or if any argument has an
|
|
expected number of constructor arguments, or if any argument has an
|
|
@@ -194,45 +194,45 @@ extern class Type {
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns a list of the instance fields of class `c`.
|
|
Returns a list of the instance fields of class `c`.
|
|
-
|
|
|
|
|
|
+
|
|
This only includes fields which are known at compile-time. In
|
|
This only includes fields which are known at compile-time. In
|
|
particular, using getInstanceFields(getClass(obj)) will not include
|
|
particular, using getInstanceFields(getClass(obj)) will not include
|
|
any fields which were added to obj at runtime.
|
|
any fields which were added to obj at runtime.
|
|
-
|
|
|
|
|
|
+
|
|
The order of the fields in the returned Array is unspecified.
|
|
The order of the fields in the returned Array is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` is null, the result is unspecified.
|
|
If `c` is null, the result is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
(As3) This method only returns instance fields that are public.
|
|
(As3) This method only returns instance fields that are public.
|
|
**/
|
|
**/
|
|
public static function getInstanceFields( c : Class<Dynamic> ) : Array<String>;
|
|
public static function getInstanceFields( c : Class<Dynamic> ) : Array<String>;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns a list of static fields of class `c`.
|
|
Returns a list of static fields of class `c`.
|
|
-
|
|
|
|
|
|
+
|
|
This does not include static fields of parent classes.
|
|
This does not include static fields of parent classes.
|
|
-
|
|
|
|
|
|
+
|
|
The order of the fields in the returned Array is unspecified.
|
|
The order of the fields in the returned Array is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` is null, the result is unspecified.
|
|
If `c` is null, the result is unspecified.
|
|
-
|
|
|
|
|
|
+
|
|
(As3) This method only returns class fields that are public.
|
|
(As3) This method only returns class fields that are public.
|
|
**/
|
|
**/
|
|
public static function getClassFields( c : Class<Dynamic> ) : Array<String>;
|
|
public static function getClassFields( c : Class<Dynamic> ) : Array<String>;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns a list of the names of all constructors of enum `e`.
|
|
Returns a list of the names of all constructors of enum `e`.
|
|
-
|
|
|
|
|
|
+
|
|
The order of the constructor names in the returned Array is preserved
|
|
The order of the constructor names in the returned Array is preserved
|
|
from the original syntax.
|
|
from the original syntax.
|
|
-
|
|
|
|
|
|
+
|
|
If `c` is null, the result is unspecified.
|
|
If `c` is null, the result is unspecified.
|
|
**/
|
|
**/
|
|
public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String>;
|
|
public static function getEnumConstructs( e : Enum<Dynamic> ) : Array<String>;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the runtime type of value `v`.
|
|
Returns the runtime type of value `v`.
|
|
-
|
|
|
|
|
|
+
|
|
The result corresponds to the type `v` has at runtime, which may vary
|
|
The result corresponds to the type `v` has at runtime, which may vary
|
|
per platform. Assumptions regarding this should be minimized to avoid
|
|
per platform. Assumptions regarding this should be minimized to avoid
|
|
surprises.
|
|
surprises.
|
|
@@ -241,41 +241,41 @@ extern class Type {
|
|
|
|
|
|
/**
|
|
/**
|
|
Recursively compares two enum instances `a` and `b` by value.
|
|
Recursively compares two enum instances `a` and `b` by value.
|
|
-
|
|
|
|
|
|
+
|
|
Unlike `a == b`, this function performs a deep equality check on the
|
|
Unlike `a == b`, this function performs a deep equality check on the
|
|
arguments of the constructors, if exists.
|
|
arguments of the constructors, if exists.
|
|
-
|
|
|
|
|
|
+
|
|
If `a` or `b` are null, the result is unspecified.
|
|
If `a` or `b` are null, the result is unspecified.
|
|
**/
|
|
**/
|
|
public static function enumEq<T:EnumValue>( a : T, b : T ) : Bool;
|
|
public static function enumEq<T:EnumValue>( a : T, b : T ) : Bool;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the constructor name of enum instance `e`.
|
|
Returns the constructor name of enum instance `e`.
|
|
-
|
|
|
|
|
|
+
|
|
The result String does not contain any constructor arguments.
|
|
The result String does not contain any constructor arguments.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` is null, the result is unspecified.
|
|
If `e` is null, the result is unspecified.
|
|
**/
|
|
**/
|
|
public static function enumConstructor( e : EnumValue ) : String;
|
|
public static function enumConstructor( e : EnumValue ) : String;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns a list of the constructor arguments of enum instance `e`.
|
|
Returns a list of the constructor arguments of enum instance `e`.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` has no arguments, the result is [].
|
|
If `e` has no arguments, the result is [].
|
|
-
|
|
|
|
|
|
+
|
|
Otherwise the result are the values that were used as arguments to `e`,
|
|
Otherwise the result are the values that were used as arguments to `e`,
|
|
in the order of their declaration.
|
|
in the order of their declaration.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` is null, the result is unspecified.
|
|
If `e` is null, the result is unspecified.
|
|
**/
|
|
**/
|
|
public static function enumParameters( e : EnumValue ) : Array<Dynamic>;
|
|
public static function enumParameters( e : EnumValue ) : Array<Dynamic>;
|
|
|
|
|
|
/**
|
|
/**
|
|
Returns the index of enum instance `e`.
|
|
Returns the index of enum instance `e`.
|
|
-
|
|
|
|
|
|
+
|
|
This corresponds to the original syntactic position of `e`. The index of
|
|
This corresponds to the original syntactic position of `e`. The index of
|
|
the first declared constructor is 0, the next one is 1 etc.
|
|
the first declared constructor is 0, the next one is 1 etc.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` is null, the result is unspecified.
|
|
If `e` is null, the result is unspecified.
|
|
**/
|
|
**/
|
|
public static function enumIndex( e : EnumValue ) : Int;
|
|
public static function enumIndex( e : EnumValue ) : Int;
|
|
@@ -283,14 +283,14 @@ extern class Type {
|
|
/**
|
|
/**
|
|
Returns a list of all constructors of enum `e` that require no
|
|
Returns a list of all constructors of enum `e` that require no
|
|
arguments.
|
|
arguments.
|
|
-
|
|
|
|
|
|
+
|
|
This may return the empty Array [] if all constructors of `e` require
|
|
This may return the empty Array [] if all constructors of `e` require
|
|
arguments.
|
|
arguments.
|
|
-
|
|
|
|
|
|
+
|
|
Otherwise an instance of `e` constructed through each of its non-
|
|
Otherwise an instance of `e` constructed through each of its non-
|
|
argument constructors is returned, in the order of the constructor
|
|
argument constructors is returned, in the order of the constructor
|
|
declaration.
|
|
declaration.
|
|
-
|
|
|
|
|
|
+
|
|
If `e` is null, the result is unspecified.
|
|
If `e` is null, the result is unspecified.
|
|
**/
|
|
**/
|
|
public static function allEnums<T>( e : Enum<T> ) : Array<T>;
|
|
public static function allEnums<T>( e : Enum<T> ) : Array<T>;
|