new Namespace(parent, name, options)
Constructs a new Namespace.
Parameters:
Name | Type | Description |
---|---|---|
parent |
ProtoBuf.Reflect.Namespace | null | Namespace parent |
name |
string | Namespace name |
options |
Object.<string,*> | Namespace options |
Extends
Members
-
children :Array.<ProtoBuf.Reflect.T>
-
Children inside the namespace.
-
name :string
-
Object name in namespace.
- Inherited From:
-
options :Object.<string, *>
-
Options.
-
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
Throws:
If the child cannot be added (duplicate)- Type
- Error
-
build() → {Object.<string,Function|Object>}
-
Builds the namespace and returns the runtime counterpart.
Returns:
Runtime namespace
- Type
- Object.<string,Function | Object>
-
buildOpt() → {Object.<string,*>}
-
Builds the namespace's '$options' property.
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
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).
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.
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
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
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