EnumValueTools

package haxe

import haxe.EnumTools

Available on all platforms

This class provides advanced methods on enum values. It is ideally used with using EnumValueTools and then acts as an extension to the EnumValue types.

If the first argument to any of the methods is null, the result is unspecified.

Static methods

staticinlineequals<T>(a:T, b:T):Bool

Recursively compares two enum instances a and b by value.

Unlike a == b, this function performs a deep equality check on the arguments of the constructors (if there are any).

If a or b are null, the result is unspecified.

staticinlinegetIndex(e:EnumValue):Int

Returns the index of enum instance e.

This corresponds to the original syntactic position of e. The index of the first declared constructor is 0, the next one is 1 etc.

If e is null, the result is unspecified.

staticinlinegetName(e:EnumValue):String

Returns the constructor name of enum instance e.

The result String does not contain any constructor arguments.

If e is null, the result is unspecified.

staticinlinegetParameters(e:EnumValue):Array<Dynamic>

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.

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/haxe/EnumValueTools.html