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