# class Type

#### no package

Available on all platforms

The Haxe Reflection API allows retrieval of type information at runtime.

This class complements the more lightweight Reflect class, with a focus on class and enum instances.

See:

https://haxe.org/manual/types.html

https://haxe.org/manual/std-reflection.html

### Static methods

###

`staticcreateEmptyInstance<T> (cl:Class<T>):T`

Creates an instance of class `cl`.

This function guarantees that the class constructor is not called.

If `cl` is null, the result is unspecified.

###

`staticcreateEnum<T> (e:Enum<T>, constr:String, ?params:Array<Dynamic>):T`

Creates an instance of enum `e` by calling its constructor `constr` with arguments `params`.

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 expected number of constructor arguments, or if any argument has an invalid type, the result is unspecified.

###

`staticcreateInstance<T> (cl:Class<T>, args:Array<Dynamic>):T`

Creates an instance of class `cl`, using `args` as arguments to the class constructor.

This function guarantees that the class constructor is called.

Default values of constructors arguments are not guaranteed to be taken into account.

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 argument has an invalid type, or if `cl` has no own constructor, the result is unspecified.

In particular, default values of constructor arguments are not guaranteed to be taken into account.

###

`staticenumParameters (e:EnumValue):Array<Dynamic>`

Available on Android, Flash, iOS, Linux, macOS, Neko, Windows

Returns a list of the constructor arguments of enum instance `e`.

If `e` has no arguments, the result is [].

Otherwise the result are the values that were used as arguments to `e`, in the order of their declaration.

If `e` is null, the result is unspecified.

###

`staticgetClass<T> (o:T):Class<T>`

Available on Android, Flash, iOS, Linux, macOS, Neko, Windows

Returns the class of `o`, if `o` is a class instance.

If `o` is null or of a different type, null is returned.

In general, type parameter information cannot be obtained at runtime.

###

`staticgetClassName (c:Class<Dynamic>):String`

Returns the name of class `c`, including its path.

If `c` is inside a package, the package structure is returned dot- separated, with another dot separating the class name: `pack1.pack2.(...).packN.ClassName` If `c` is a sub-type of a Haxe module, that module is not part of the package structure.

If `c` has no package, the class name is returned.

If `c` is null, the result is unspecified.

The class name does not include any type parameters.

###

`staticgetEnumConstructs (e:Enum<Dynamic>):Array<String>`

Available on Android, Flash, iOS, Linux, macOS, Neko, Windows

Returns a list of the names of all constructors of enum `e`.

The order of the constructor names in the returned Array is preserved from the original syntax.

If `c` is null, the result is unspecified.

###

`staticgetEnumName (e:Enum<Dynamic>):String`

Returns the name of enum `e`, including its path.

If `e` is inside a package, the package structure is returned dot- separated, with another dot separating the enum name: `pack1.pack2.(...).packN.EnumName` If `e` is a sub-type of a Haxe module, that module is not part of the package structure.

If `e` has no package, the enum name is returned.

If `e` is null, the result is unspecified.

The enum name does not include any type parameters.

###

`staticgetSuperClass (c:Class<Dynamic>):Class<Dynamic>`

Returns the super-class of class `c`.

If `c` has no super class, null is returned.

If `c` is null, the result is unspecified.

In general, type parameter information cannot be obtained at runtime.

###

`staticresolveClass (name:String):Class<Dynamic>`

Resolves a class by name.

If `name` is the path of an existing class, that class is returned.

Otherwise null is returned.

If `name` is null or the path to a different type, the result is unspecified.

The class name must not include any type parameters.

###

`staticresolveEnum (name:String):Enum<Dynamic>`

Resolves an enum by name.

If `name` is the path of an existing enum, that enum is returned.

Otherwise null is returned.

If `name` is null the result is unspecified.

If `name` is the path to a different type, null is returned.

The enum name must not include any type parameters.

###

`statictypeof (v:Dynamic):ValueType`

Returns the runtime type of value `v`.

The result corresponds to the type `v` has at runtime, which may vary per platform. Assumptions regarding this should be minimized to avoid surprises.