Constructs a new enum instance.
| Name | Type | Description |
|---|---|---|
name |
string |
Unique name within its namespace |
values |
Object.<string, number> |
optional
Enum values as an object, by name |
options |
Object.<string, *> |
optional
Declared options |
comment |
string |
optional
The comment for this enum |
comments |
Object.<string, string> |
optional
The value comments for this enum |
valuesOptions |
Object.<string, Object.<string, *>> | undefined |
optional
The value options for this enum |
Extends
Members
-
comment { string | null }
-
Enum comment text.
-
comments { Object<string, string> }
-
Value comment texts, if any.
-
filename { string | null }
-
Defining file name.
-
fullName readonly{ string }
-
Full name including leading dot.
-
name { string }
-
Unique name within its namespace.
-
options { Object<string, *> | undefined }
-
Options.
-
parent { Namespace | null }
-
Parent namespace.
-
parsedOptions { Object<string, *>[] | undefined }
-
Parsed Options.
-
reserved { (number[]|string)[] }
-
Reserved ranges, if any.
-
resolved { boolean }
-
Whether already resolved or not.
-
root readonly{ Root }
-
Reference to the root namespace.
-
values { Object<string, number> }
-
Enum values by name.
-
valuesById { Object<number, string> }
-
Enum values by id.
-
valuesOptions { Object<string, Object<string, *>> | undefined }
-
Values options, if any
Methods
-
Adds a value to this enum.
Name Type Description namestring Value name
idnumber Value id
commentstring optional Comment, if any
optionsObject.<string, *> | undefined optional Options, if any
Throws:
-
Type Description TypeError If arguments are invalid
-
Type Description Error If there is already a value with this name or id
Returns:
Type Description Enum this -
-
Gets an option value.
Name Type Description namestring Option name
Returns:
Type Description * Option value or undefinedif not set -
Tests if the specified id is reserved.
Name Type Description idnumber Id to test
Returns:
Type Description boolean trueif reserved, otherwisefalse -
Tests if the specified name is reserved.
Name Type Description namestring Name to test
Returns:
Type Description boolean trueif reserved, otherwisefalse -
Called when this object is added to a parent.
Name Type Description parentReflectionObject Parent added to
Returns:
Type Description undefined -
Called when this object is removed from a parent.
Name Type Description parentReflectionObject Parent removed from
Returns:
Type Description undefined -
Removes a value from this enum
Name Type Description namestring Value name
Throws:
-
Type Description TypeError If arguments are invalid
-
Type Description Error If
nameis not a name of this enum
Returns:
Type Description Enum this -
-
inherited resolve(){ ReflectionObject }
-
Resolves this objects type references.
Returns:
Type Description ReflectionObject this -
inherited setOption(name, value, ifNotSet){ ReflectionObject }
-
Sets an option.
Name Type Description namestring Option name
value* Option value
ifNotSetboolean | undefined optional Sets the option only if it isn't currently set
Returns:
Type Description ReflectionObject this -
inherited setOptions(options, ifNotSet){ ReflectionObject }
-
Sets multiple options.
Name Type Description optionsObject.<string, *> Options to set
ifNotSetboolean optional Sets an option only if it isn't currently set
Returns:
Type Description ReflectionObject this -
inherited setParsedOption(name, value, propName){ ReflectionObject }
-
Sets a parsed option.
Name Type Description namestring parsed Option name
value* Option value
propNamestring dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value
Returns:
Type Description ReflectionObject this -
Converts this enum to an enum descriptor.
Name Type Description toJSONOptionsIToJSONOptions optional JSON conversion options
Returns:
Type Description IEnum Enum descriptor -
Converts this instance to its string representation.
Returns:
Type Description string Class name[, space, full name] -
Constructs an enum from an enum descriptor.
Name Type Description namestring Enum name
jsonIEnum Enum descriptor
Throws:
Type Description TypeError If arguments are invalid
Returns:
Type Description Enum Created enum