new Enum(parent, name, options)
Constructs a new Enum.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
parent |
ProtoBuf.Reflect.T | Parent Reflect object |
|
name |
string | Enum name |
|
options |
Object.<string.*> |
<optional> |
Enum options |
Extends
Classes
Members
-
children :Array.<ProtoBuf.Reflect.T>
-
Children inside the namespace.
- Inherited From:
-
name :string
-
Object name in namespace.
- Inherited From:
-
object :Object.<string,number>|null
-
Runtime enum object.
-
options :Object.<string, *>
-
Options.
- Inherited From:
-
parent :ProtoBuf.Reflect.T|null
-
Parent object.
- Inherited From:
Methods
-
addChild(child)
-
Adds a child to the namespace.
Parameters:
Name Type Description child
ProtoBuf.Reflect.T Child
- Inherited From:
Throws:
If the child cannot be added (duplicate)- Type
- Error
-
build() → {Object<string,*>}
-
Builds this enum and returns the runtime counterpart.
Returns:
- Type
- Object<string,*>
-
buildOpt() → {Object.<string,*>}
-
Builds the namespace's '$options' property.
- Inherited From:
Returns:
- Type
- Object.<string,*>
-
fqn() → {string}
-
Returns the fully qualified name of this object.
- Inherited From:
Returns:
Fully qualified name as of ".PATH.TO.THIS"
- Type
- string
-
getChild(nameOrId) → {ProtoBuf.Reflect.T}
-
Gets a child by its name.
Parameters:
Name Type Description nameOrId
string | number Child name or id
- Inherited From:
Returns:
The child or null if not found
- Type
- ProtoBuf.Reflect.T
-
getChildren(type) → {Array.<ProtoBuf.Reflect.T>}
-
Returns an array of the namespace's children.
Parameters:
Name Type Argument Description type
ProtoBuf.Reflect.T <optional>
Filter type (returns instances of this type only). Defaults to null (all children).
- Inherited From:
Returns:
- Type
- Array.<ProtoBuf.Reflect.T>
-
getOption(name) → {*|Object.<string,*>}
-
Gets the value assigned to the option with the specified name.
Parameters:
Name Type Argument Description name
string <optional>
Returns the option value if specified, otherwise all options are returned.
- Inherited From:
Returns:
null} Option value or NULL if there is no such option
- Type
- * | Object.<string,*>
-
hasChild(nameOrId) → {boolean}
-
Tests if this namespace has a child with the specified name.
Parameters:
Name Type Description nameOrId
string | number Child name or id
- Inherited From:
Returns:
true if there is one, else false
- Type
- boolean
-
resolve(qn, excludeFields) → {ProtoBuf.Reflect.Namespace|null}
-
Resolves a reflect object inside of this namespace.
Parameters:
Name Type Argument Description qn
string Qualified name to resolve
excludeFields
boolean <optional>
Excludes fields, defaults to
false
- Inherited From:
Returns:
The resolved type or null if not found
- Type
- ProtoBuf.Reflect.Namespace | null
-
toString(includeClass)
-
Returns a string representation of this Reflect object (its fully qualified name).
Parameters:
Name Type Argument Description includeClass
boolean <optional>
Set to true to include the class name. Defaults to false.
- Inherited From:
Returns:
String representation