<abstract> new KeyedEnum(name, key)
Constructor.
Extends:
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | the unique name for this type |
key |
string | the key value associated with this type |
Extends
Members
-
key
-
Get the key value.
-
name
-
Get the enum name.
- Inherited From:
- Overrides:
Methods
-
<static> valueOf(value)
-
Get an enum instance from its key or name.
This method searches the module:util~Enum#enumVvalues array for a matching key or name value.
Parameters:
Name Type Description valuestring the enum key or name to get the enum instance for
Returns:
the matching enum value, or
nullif no values match- Type
- module:util~KeyedEnum | null
-
equals(value)
-
Test if a string is equal to this enum's name.
As long as enum values are consistently obtained from the module:util~Enum.enumValues array then enum instances can be compared with
===. If unsure, this method can be used to compare string values instead.If
valueis passed as an actual Enum instance, then if that enum is the same class as this enum it'snameis compared to this instance'sname.Parameters:
Name Type Description valuestring | Enum the value to test
- Inherited From:
- Overrides:
Returns:
trueifvalueis the same as this instance'snamevalue- Type
- boolean