Class: Service

ProtoBuf.Reflect. Service

new Service(root, name, options)

Constructs a new Service.

Parameters:
Name Type Argument Description
root ProtoBuf.Reflect.Namespace

Root

name string

Service name

options Object.<string,*> <optional>

Options

Extends

Classes

Method
RPCMethod

Members

children :Array.<ProtoBuf.Reflect.T>

Children inside the namespace.

Inherited From:

clazz :function(new:ProtoBuf.Builder.Service)

Built runtime service class.

name :string

Object name in namespace.

Inherited From:

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(rebuild) → {Function}

Builds the service and returns the runtime counterpart, which is a fully functional class.

Parameters:
Name Type Argument Description
rebuild boolean <optional>

Whether to rebuild or not

See:
Throws:
If the message cannot be built
Type
Error
Returns:

Service class

Type
Function

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