<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Builder</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Builder</h1> <section> <header> <h2> <span class="ancestors"><a href="ProtoBuf.html">ProtoBuf</a>.</span> Builder </h2> <div class="class-description"><p>Provides the functionality to build protocol messages.</p></div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="Builder"><span class="type-signature"></span>new Builder<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> <p>Constructs a new Builder.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object.<string, *></span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Options</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4295">line 4295</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Classes</h3> <dl> <dt><a href="ProtoBuf.Builder.Message.html">Message</a></dt> <dd></dd> <dt><a href="ProtoBuf.Builder.Service.html">Service</a></dt> <dd></dd> </dl> <h3 class="subsection-title">Members</h3> <h4 class="name" id="files"><span class="type-signature"></span>files<span class="type-signature"> :Array.<string></span></h4> <div class="description"> <p>Imported files.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Array.<string></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4330">line 4330</a> </li></ul></dd> </dl> <h4 class="name" id="importRoot"><span class="type-signature">(nullable) </span>importRoot<span class="type-signature"> :string</span></h4> <div class="description"> <p>Import root override.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4337">line 4337</a> </li></ul></dd> </dl> <h4 class="name" id="ns"><span class="type-signature"></span>ns<span class="type-signature"> :<a href="ProtoBuf.Reflect.Namespace.html">ProtoBuf.Reflect.Namespace</a></span></h4> <div class="description"> <p>Namespace.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="ProtoBuf.Reflect.Namespace.html">ProtoBuf.Reflect.Namespace</a></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4302">line 4302</a> </li></ul></dd> </dl> <h4 class="name" id="options"><span class="type-signature">(non-null) </span>options<span class="type-signature"> :Object.<string, *></span></h4> <div class="description"> <p>Options.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object.<string, *></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4344">line 4344</a> </li></ul></dd> </dl> <h4 class="name" id="ptr"><span class="type-signature"></span>ptr<span class="type-signature"> :<a href="ProtoBuf.Reflect.T.html">ProtoBuf.Reflect.T</a></span></h4> <div class="description"> <p>Namespace pointer.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type"><a href="ProtoBuf.Reflect.T.html">ProtoBuf.Reflect.T</a></span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4309">line 4309</a> </li></ul></dd> </dl> <h4 class="name" id="resolved"><span class="type-signature"></span>resolved<span class="type-signature"> :boolean</span></h4> <div class="description"> <p>Resolved flag.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">boolean</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4316">line 4316</a> </li></ul></dd> </dl> <h4 class="name" id="result"><span class="type-signature"></span>result<span class="type-signature"> :Object.<string, (<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>|Object)>|null</span></h4> <div class="description"> <p>The current building result.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">Object.<string, (<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>|Object)></span> | <span class="param-type">null</span> </li> </ul> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4323">line 4323</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".isEnum"><span class="type-signature">(static) </span>isEnum<span class="signature">(def<span class="signature-attributes">non-null</span>)</span><span class="type-signature"> → {boolean}</span></h4> <div class="description"> <p>Tests if a definition most likely describes an enum.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>def</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4390">line 4390</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id=".isExtend"><span class="type-signature">(static) </span>isExtend<span class="signature">(def<span class="signature-attributes">non-null</span>)</span><span class="type-signature"> → {boolean}</span></h4> <div class="description"> <p>Tests if a definition most likely describes an extended message</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>def</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4419">line 4419</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id=".isMessage"><span class="type-signature">(static) </span>isMessage<span class="signature">(def<span class="signature-attributes">non-null</span>)</span><span class="type-signature"> → {boolean}</span></h4> <div class="description"> <p>Tests if a definition most likely describes a message.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>def</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4361">line 4361</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id=".isMessageField"><span class="type-signature">(static) </span>isMessageField<span class="signature">(def<span class="signature-attributes">non-null</span>)</span><span class="type-signature"> → {boolean}</span></h4> <div class="description"> <p>Tests if a definition most likely describes a message field.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>def</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4377">line 4377</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id=".isService"><span class="type-signature">(static) </span>isService<span class="signature">(def<span class="signature-attributes">non-null</span>)</span><span class="type-signature"> → {boolean}</span></h4> <div class="description"> <p>Tests if a definition most likely describes a service.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>def</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4406">line 4406</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id="%22import%22%5D"><span class="type-signature"></span>"import"]<span class="signature">(json, filename<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a>}</span></h4> <div class="description"> <p>Imports another definition into this builder.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>json</code></td> <td class="type"> <span class="param-type">Object.<string, *></span> </td> <td class="attributes"> </td> <td class="description last"><p>Parsed import</p></td> </tr> <tr> <td class="name"><code>filename</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">Object</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Imported file name</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4640">line 4640</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> <p>If the definition or file cannot be imported</p> </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>this</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a></span> </dd> </dl> <h4 class="name" id="build"><span class="type-signature"></span>build<span class="signature">(path<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a>|!Object.<string, *>}</span></h4> <div class="description"> <p>Builds the protocol. This will first try to resolve all definitions and, if this has been successful, return the built package.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>path</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">Array.<string></span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Specifies what to return. If omitted, the entire namespace will be returned.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4853">line 4853</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> <p>If a type could not be resolved</p> </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ProtoBuf.Builder.Message.html">ProtoBuf.Builder.Message</a></span> | <span class="param-type">!Object.<string, *></span> </dd> </dl> <h4 class="name" id="create"><span class="type-signature"></span>create<span class="signature">(defs<span class="signature-attributes">non-null</span>)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a>}</span></h4> <div class="description"> <p>Creates the specified definitions at the current pointer position.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>defs</code></td> <td class="type"> <span class="param-type">Array.<!Object></span> </td> <td class="description last"><p>Messages, enums or services to create</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4463">line 4463</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> <p>If a message definition is invalid</p> </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>this</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a></span> </dd> </dl> <h4 class="name" id="define"><span class="type-signature"></span>define<span class="signature">(namespace)</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a>}</span></h4> <div class="description"> <p>Defines a namespace on top of the current pointer position and places the pointer on it.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>namespace</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4444">line 4444</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>this</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a></span> </dd> </dl> <h4 class="name" id="lookup"><span class="type-signature"></span>lookup<span class="signature">(path<span class="signature-attributes">opt</span>, excludeNonNamespace<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → (nullable) {<a href="ProtoBuf.Reflect.T.html">ProtoBuf.Reflect.T</a>}</span></h4> <div class="description"> <p>Similar to <a href="ProtoBuf.Builder.html#build">ProtoBuf.Builder#build</a>, but looks up the internal reflection descriptor.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>path</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Specifies what to return. If omitted, the entire namespace wiil be returned.</p></td> </tr> <tr> <td class="name"><code>excludeNonNamespace</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> <optional><br> </td> <td class="description last"><p>Excludes non-namespace types like fields, defaults to <code>false</code></p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4881">line 4881</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Reflection descriptor or <code>null</code> if not found</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ProtoBuf.Reflect.T.html">ProtoBuf.Reflect.T</a></span> </dd> </dl> <h4 class="name" id="reset"><span class="type-signature"></span>reset<span class="signature">()</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a>}</span></h4> <div class="description"> <p>Resets the pointer to the root namespace.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4433">line 4433</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>this</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a></span> </dd> </dl> <h4 class="name" id="resolveAll"><span class="type-signature"></span>resolveAll<span class="signature">()</span><span class="type-signature"> → (non-null) {<a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a>}</span></h4> <div class="description"> <p>Resolves all namespace objects.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4769">line 4769</a> </li></ul></dd> </dl> <h5>Throws:</h5> <dl> <dt> <div class="param-desc"> <p>If a type cannot be resolved</p> </div> </dt> <dd></dd> <dt> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>this</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="ProtoBuf.Builder.html">ProtoBuf.Builder</a></span> </dd> </dl> <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> → {string}</span></h4> <div class="description"> <p>Returns a string representation of this object.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="protobuf.js.html">protobuf.js</a>, <a href="protobuf.js.html#line4890">line 4890</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>String representation as of "Builder"</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ProtoBuf.Builder.html">Builder</a></li><li><a href="ProtoBuf.Builder.Message.html">Message</a></li><li><a href="ProtoBuf.Builder.Service.html">Service</a></li><li><a href="ProtoBuf.DotProto.Parser.html">Parser</a></li><li><a href="ProtoBuf.DotProto.Tokenizer.html">Tokenizer</a></li><li><a href="ProtoBuf.Map.html">Map</a></li><li><a href="ProtoBuf.Reflect.Element.html">Element</a></li><li><a href="ProtoBuf.Reflect.Enum.html">Enum</a></li><li><a href="ProtoBuf.Reflect.Enum.Value.html">Value</a></li><li><a href="ProtoBuf.Reflect.Extension.html">Extension</a></li><li><a href="ProtoBuf.Reflect.Message.html">Message</a></li><li><a href="ProtoBuf.Reflect.Message.ExtensionField.html">ExtensionField</a></li><li><a href="ProtoBuf.Reflect.Message.Field.html">Field</a></li><li><a href="ProtoBuf.Reflect.Message.OneOf.html">OneOf</a></li><li><a href="ProtoBuf.Reflect.Namespace.html">Namespace</a></li><li><a href="ProtoBuf.Reflect.Service.html">Service</a></li><li><a href="ProtoBuf.Reflect.Service.Method.html">Method</a></li><li><a href="ProtoBuf.Reflect.Service.RPCMethod.html">RPCMethod</a></li><li><a href="ProtoBuf.Reflect.T.html">T</a></li></ul><h3>Namespaces</h3><ul><li><a href="ProtoBuf.html">ProtoBuf</a></li><li><a href="ProtoBuf.DotProto.html">DotProto</a></li><li><a href="ProtoBuf.Reflect.html">Reflect</a></li><li><a href="ProtoBuf.Util.html">Util</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.3</a> on Fri Jan 27 2017 17:03:55 GMT+0100 (Mitteleuropäische Zeit) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>