helloworld_js generation complete
This commit is contained in:
		| @@ -1,16 +1,11 @@ | |||||||
| // GENERATED CODE -- DO NOT EDIT! | // GENERATED CODE -- DO NOT EDIT! | ||||||
|  |  | ||||||
|  |  | ||||||
| var jspb = require('google-protobuf'); | var jspb = require('google-protobuf'); | ||||||
| var goog = jspb; | var goog = jspb; | ||||||
| var global = Function('return this')(); | var global = Function('return this')(); | ||||||
|  |  | ||||||
|  | goog.exportSymbol('proto.helloworld.HelloRequest', null, global); | ||||||
| goog.exportSymbol('proto.user.HelloRequest', null, global); | goog.exportSymbol('proto.helloworld.HelloReply', null, global); | ||||||
|  |  | ||||||
| goog.exportSymbol('proto.user.HelloReply', null, global); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @param {Array=} opt_data Optional initial data array, typically from a |  * @param {Array=} opt_data Optional initial data array, typically from a | ||||||
| @@ -21,12 +16,12 @@ goog.exportSymbol('proto.user.HelloReply', null, global); | |||||||
|  * @extends {jspb.Message} |  * @extends {jspb.Message} | ||||||
|  * @constructor |  * @constructor | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest = function(opt_data) { | proto.helloworld.HelloRequest = function(opt_data) { | ||||||
|   jspb.Message.initialize(this, opt_data, 0, -1, null, null); |   jspb.Message.initialize(this, opt_data, 0, -1, null, null); | ||||||
| }; | }; | ||||||
| goog.inherits(proto.user.HelloRequest, jspb.Message); | goog.inherits(proto.helloworld.HelloRequest, jspb.Message); | ||||||
| if (goog.DEBUG && !COMPILED) { | if (goog.DEBUG && !COMPILED) { | ||||||
|   proto.user.HelloRequest.displayName = 'proto.user.HelloRequest'; |   proto.helloworld.HelloRequest.displayName = 'proto.helloworld.HelloRequest'; | ||||||
| } | } | ||||||
|  |  | ||||||
| if (jspb.Message.GENERATE_TO_OBJECT) { | if (jspb.Message.GENERATE_TO_OBJECT) { | ||||||
| @@ -40,8 +35,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { | |||||||
|  *     for transitional soy proto support: http://goto/soy-param-migration |  *     for transitional soy proto support: http://goto/soy-param-migration | ||||||
|  * @return {!Object} |  * @return {!Object} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.prototype.toObject = function(opt_includeInstance) { | proto.helloworld.HelloRequest.prototype.toObject = function(opt_includeInstance) { | ||||||
|   return proto.user.HelloRequest.toObject(opt_includeInstance, this); |   return proto.helloworld.HelloRequest.toObject(opt_includeInstance, this); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -49,12 +44,12 @@ proto.user.HelloRequest.prototype.toObject = function(opt_includeInstance) { | |||||||
|  * @param {boolean|undefined} includeInstance Whether to include the JSPB |  * @param {boolean|undefined} includeInstance Whether to include the JSPB | ||||||
|  *     instance for transitional soy proto support: |  *     instance for transitional soy proto support: | ||||||
|  *     http://goto/soy-param-migration |  *     http://goto/soy-param-migration | ||||||
|  * @param {!proto.user.HelloRequest} msg The msg instance to transform. |  * @param {!proto.helloworld.HelloRequest} msg The msg instance to transform. | ||||||
|  * @return {!Object} |  * @return {!Object} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.toObject = function(includeInstance, msg) { | proto.helloworld.HelloRequest.toObject = function(includeInstance, msg) { | ||||||
|   var f, obj = { |   var f, obj = { | ||||||
|     profile: (f = msg.getProfile()) && proto.user.Profile.toObject(includeInstance, f) |     name: jspb.Message.getFieldWithDefault(msg, 1, "") | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   if (includeInstance) { |   if (includeInstance) { | ||||||
| @@ -67,22 +62,22 @@ proto.user.HelloRequest.toObject = function(includeInstance, msg) { | |||||||
| /** | /** | ||||||
|  * Deserializes binary data (in protobuf wire format). |  * Deserializes binary data (in protobuf wire format). | ||||||
|  * @param {jspb.ByteSource} bytes The bytes to deserialize. |  * @param {jspb.ByteSource} bytes The bytes to deserialize. | ||||||
|  * @return {!proto.user.HelloRequest} |  * @return {!proto.helloworld.HelloRequest} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.deserializeBinary = function(bytes) { | proto.helloworld.HelloRequest.deserializeBinary = function(bytes) { | ||||||
|   var reader = new jspb.BinaryReader(bytes); |   var reader = new jspb.BinaryReader(bytes); | ||||||
|   var msg = new proto.user.HelloRequest; |   var msg = new proto.helloworld.HelloRequest; | ||||||
|   return proto.user.HelloRequest.deserializeBinaryFromReader(msg, reader); |   return proto.helloworld.HelloRequest.deserializeBinaryFromReader(msg, reader); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Deserializes binary data (in protobuf wire format) from the |  * Deserializes binary data (in protobuf wire format) from the | ||||||
|  * given reader into the given message object. |  * given reader into the given message object. | ||||||
|  * @param {!proto.user.HelloRequest} msg The message object to deserialize into. |  * @param {!proto.helloworld.HelloRequest} msg The message object to deserialize into. | ||||||
|  * @param {!jspb.BinaryReader} reader The BinaryReader to use. |  * @param {!jspb.BinaryReader} reader The BinaryReader to use. | ||||||
|  * @return {!proto.user.HelloRequest} |  * @return {!proto.helloworld.HelloRequest} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.deserializeBinaryFromReader = function(msg, reader) { | proto.helloworld.HelloRequest.deserializeBinaryFromReader = function(msg, reader) { | ||||||
|   while (reader.nextField()) { |   while (reader.nextField()) { | ||||||
|     if (reader.isEndGroup()) { |     if (reader.isEndGroup()) { | ||||||
|       break; |       break; | ||||||
| @@ -90,9 +85,8 @@ proto.user.HelloRequest.deserializeBinaryFromReader = function(msg, reader) { | |||||||
|     var field = reader.getFieldNumber(); |     var field = reader.getFieldNumber(); | ||||||
|     switch (field) { |     switch (field) { | ||||||
|     case 1: |     case 1: | ||||||
|       var value = new proto.user.Profile; |       var value = /** @type {string} */ (reader.readString()); | ||||||
|       reader.readMessage(value,proto.user.Profile.deserializeBinaryFromReader); |       msg.setName(value); | ||||||
|       msg.setProfile(value); |  | ||||||
|       break; |       break; | ||||||
|     default: |     default: | ||||||
|       reader.skipField(); |       reader.skipField(); | ||||||
| @@ -105,10 +99,10 @@ proto.user.HelloRequest.deserializeBinaryFromReader = function(msg, reader) { | |||||||
| /** | /** | ||||||
|  * Class method variant: serializes the given message to binary data |  * Class method variant: serializes the given message to binary data | ||||||
|  * (in protobuf wire format), writing to the given BinaryWriter. |  * (in protobuf wire format), writing to the given BinaryWriter. | ||||||
|  * @param {!proto.user.HelloRequest} message |  * @param {!proto.helloworld.HelloRequest} message | ||||||
|  * @param {!jspb.BinaryWriter} writer |  * @param {!jspb.BinaryWriter} writer | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.serializeBinaryToWriter = function(message, writer) { | proto.helloworld.HelloRequest.serializeBinaryToWriter = function(message, writer) { | ||||||
|   message.serializeBinaryToWriter(writer); |   message.serializeBinaryToWriter(writer); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -116,64 +110,42 @@ proto.user.HelloRequest.serializeBinaryToWriter = function(message, writer) { | |||||||
|  * Serializes the message to binary data (in protobuf wire format). |  * Serializes the message to binary data (in protobuf wire format). | ||||||
|  * @return {!Uint8Array} |  * @return {!Uint8Array} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.prototype.serializeBinary = function() { | proto.helloworld.HelloRequest.prototype.serializeBinary = function() { | ||||||
|   var writer = new jspb.BinaryWriter(); |   var writer = new jspb.BinaryWriter(); | ||||||
|   this.serializeBinaryToWriter(writer); |   this.serializeBinaryToWriter(writer); | ||||||
|   return writer.getResultBuffer(); |   return writer.getResultBuffer(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Serializes the message to binary data (in protobuf wire format), |  * Serializes the message to binary data (in protobuf wire format), | ||||||
|  * writing to the given BinaryWriter. |  * writing to the given BinaryWriter. | ||||||
|  * @param {!jspb.BinaryWriter} writer |  * @param {!jspb.BinaryWriter} writer | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.prototype.serializeBinaryToWriter = function (writer) { | proto.helloworld.name.prototype.serializeBinaryToWriter = function (writer) { | ||||||
|   var f = undefined; |   var f = undefined; | ||||||
|   f = this.getProfile(); |   f = this.getName(); | ||||||
|   if (f != null) { |   if (f.length > 0) { | ||||||
|     writer.writeMessage( |     writer.writeString( | ||||||
|       1, |       1, | ||||||
|       f, |       f | ||||||
|       proto.user.Profile.serializeBinaryToWriter |  | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * optional Profile profile = 1; |  * optional string name = 1; | ||||||
|  * @return {?proto.user.Profile} |  * @return {string} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloRequest.prototype.getProfile = function() { | proto.helloworld.name.prototype.getName = function() { | ||||||
|   return /** @type{?proto.user.Profile} */ ( |   return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); | ||||||
|     jspb.Message.getWrapperField(this, proto.user.Profile, 1)); |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** @param {?proto.user.Profile|undefined} value */ | /** @param {string} value */ | ||||||
| proto.user.HelloRequest.prototype.setProfile = function(value) { | proto.helloworld.name.prototype.setName = function(value) { | ||||||
|   jspb.Message.setWrapperField(this, 1, value); |   jspb.Message.setField(this, 1, value); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| proto.user.HelloRequest.prototype.clearProfile = function() { |  | ||||||
|   this.setProfile(undefined); |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Returns whether this field is set. |  | ||||||
|  * @return {!boolean} |  | ||||||
|  */ |  | ||||||
| proto.user.HelloRequest.prototype.hasProfile = function() { |  | ||||||
|   return jspb.Message.getField(this, 1) != null; |  | ||||||
| }; |  | ||||||
| // -------------------------------- |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @param {Array=} opt_data Optional initial data array, typically from a |  * @param {Array=} opt_data Optional initial data array, typically from a | ||||||
|  * server response, or constructed directly in Javascript. The array is used |  * server response, or constructed directly in Javascript. The array is used | ||||||
| @@ -183,12 +155,12 @@ proto.user.HelloRequest.prototype.hasProfile = function() { | |||||||
|  * @extends {jspb.Message} |  * @extends {jspb.Message} | ||||||
|  * @constructor |  * @constructor | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply = function(opt_data) { | proto.helloworld.HelloReply = function(opt_data) { | ||||||
|   jspb.Message.initialize(this, opt_data, 0, -1, null, null); |   jspb.Message.initialize(this, opt_data, 0, -1, null, null); | ||||||
| }; | }; | ||||||
| goog.inherits(proto.user.HelloReply, jspb.Message); | goog.inherits(proto.helloworld.HelloReply, jspb.Message); | ||||||
| if (goog.DEBUG && !COMPILED) { | if (goog.DEBUG && !COMPILED) { | ||||||
|   proto.user.HelloReply.displayName = 'proto.user.HelloReply'; |   proto.helloworld.HelloReply.displayName = 'proto.helloworld.HelloReply'; | ||||||
| } | } | ||||||
|  |  | ||||||
| if (jspb.Message.GENERATE_TO_OBJECT) { | if (jspb.Message.GENERATE_TO_OBJECT) { | ||||||
| @@ -202,8 +174,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { | |||||||
|  *     for transitional soy proto support: http://goto/soy-param-migration |  *     for transitional soy proto support: http://goto/soy-param-migration | ||||||
|  * @return {!Object} |  * @return {!Object} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.prototype.toObject = function(opt_includeInstance) { | proto.helloworld.HelloReply.prototype.toObject = function(opt_includeInstance) { | ||||||
|   return proto.user.HelloReply.toObject(opt_includeInstance, this); |   return proto.helloworld.HelloReply.toObject(opt_includeInstance, this); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -211,12 +183,12 @@ proto.user.HelloReply.prototype.toObject = function(opt_includeInstance) { | |||||||
|  * @param {boolean|undefined} includeInstance Whether to include the JSPB |  * @param {boolean|undefined} includeInstance Whether to include the JSPB | ||||||
|  *     instance for transitional soy proto support: |  *     instance for transitional soy proto support: | ||||||
|  *     http://goto/soy-param-migration |  *     http://goto/soy-param-migration | ||||||
|  * @param {!proto.user.HelloReply} msg The msg instance to transform. |  * @param {!proto.helloworld.HelloReply} msg The msg instance to transform. | ||||||
|  * @return {!Object} |  * @return {!Object} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.toObject = function(includeInstance, msg) { | proto.helloworld.HelloReply.toObject = function(includeInstance, msg) { | ||||||
|   var f, obj = { |   var f, obj = { | ||||||
|     profile: (f = msg.getProfile()) && proto.user.Profile.toObject(includeInstance, f) |     name: jspb.Message.getFieldWithDefault(msg, 1, "") | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   if (includeInstance) { |   if (includeInstance) { | ||||||
| @@ -229,22 +201,22 @@ proto.user.HelloReply.toObject = function(includeInstance, msg) { | |||||||
| /** | /** | ||||||
|  * Deserializes binary data (in protobuf wire format). |  * Deserializes binary data (in protobuf wire format). | ||||||
|  * @param {jspb.ByteSource} bytes The bytes to deserialize. |  * @param {jspb.ByteSource} bytes The bytes to deserialize. | ||||||
|  * @return {!proto.user.HelloReply} |  * @return {!proto.helloworld.HelloReply} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.deserializeBinary = function(bytes) { | proto.helloworld.HelloReply.deserializeBinary = function(bytes) { | ||||||
|   var reader = new jspb.BinaryReader(bytes); |   var reader = new jspb.BinaryReader(bytes); | ||||||
|   var msg = new proto.user.HelloReply; |   var msg = new proto.helloworld.HelloReply; | ||||||
|   return proto.user.HelloReply.deserializeBinaryFromReader(msg, reader); |   return proto.helloworld.HelloReply.deserializeBinaryFromReader(msg, reader); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Deserializes binary data (in protobuf wire format) from the |  * Deserializes binary data (in protobuf wire format) from the | ||||||
|  * given reader into the given message object. |  * given reader into the given message object. | ||||||
|  * @param {!proto.user.HelloReply} msg The message object to deserialize into. |  * @param {!proto.helloworld.HelloReply} msg The message object to deserialize into. | ||||||
|  * @param {!jspb.BinaryReader} reader The BinaryReader to use. |  * @param {!jspb.BinaryReader} reader The BinaryReader to use. | ||||||
|  * @return {!proto.user.HelloReply} |  * @return {!proto.helloworld.HelloReply} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.deserializeBinaryFromReader = function(msg, reader) { | proto.helloworld.HelloReply.deserializeBinaryFromReader = function(msg, reader) { | ||||||
|   while (reader.nextField()) { |   while (reader.nextField()) { | ||||||
|     if (reader.isEndGroup()) { |     if (reader.isEndGroup()) { | ||||||
|       break; |       break; | ||||||
| @@ -252,9 +224,8 @@ proto.user.HelloReply.deserializeBinaryFromReader = function(msg, reader) { | |||||||
|     var field = reader.getFieldNumber(); |     var field = reader.getFieldNumber(); | ||||||
|     switch (field) { |     switch (field) { | ||||||
|     case 1: |     case 1: | ||||||
|       var value = new proto.user.Profile; |       var value = /** @type {string} */ (reader.readString()); | ||||||
|       reader.readMessage(value,proto.user.Profile.deserializeBinaryFromReader); |       msg.setName(value); | ||||||
|       msg.setProfile(value); |  | ||||||
|       break; |       break; | ||||||
|     default: |     default: | ||||||
|       reader.skipField(); |       reader.skipField(); | ||||||
| @@ -267,10 +238,10 @@ proto.user.HelloReply.deserializeBinaryFromReader = function(msg, reader) { | |||||||
| /** | /** | ||||||
|  * Class method variant: serializes the given message to binary data |  * Class method variant: serializes the given message to binary data | ||||||
|  * (in protobuf wire format), writing to the given BinaryWriter. |  * (in protobuf wire format), writing to the given BinaryWriter. | ||||||
|  * @param {!proto.user.HelloReply} message |  * @param {!proto.helloworld.HelloReply} message | ||||||
|  * @param {!jspb.BinaryWriter} writer |  * @param {!jspb.BinaryWriter} writer | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.serializeBinaryToWriter = function(message, writer) { | proto.helloworld.HelloReply.serializeBinaryToWriter = function(message, writer) { | ||||||
|   message.serializeBinaryToWriter(writer); |   message.serializeBinaryToWriter(writer); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -278,63 +249,40 @@ proto.user.HelloReply.serializeBinaryToWriter = function(message, writer) { | |||||||
|  * Serializes the message to binary data (in protobuf wire format). |  * Serializes the message to binary data (in protobuf wire format). | ||||||
|  * @return {!Uint8Array} |  * @return {!Uint8Array} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.prototype.serializeBinary = function() { | proto.helloworld.HelloReply.prototype.serializeBinary = function() { | ||||||
|   var writer = new jspb.BinaryWriter(); |   var writer = new jspb.BinaryWriter(); | ||||||
|   this.serializeBinaryToWriter(writer); |   this.serializeBinaryToWriter(writer); | ||||||
|   return writer.getResultBuffer(); |   return writer.getResultBuffer(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Serializes the message to binary data (in protobuf wire format), |  * Serializes the message to binary data (in protobuf wire format), | ||||||
|  * writing to the given BinaryWriter. |  * writing to the given BinaryWriter. | ||||||
|  * @param {!jspb.BinaryWriter} writer |  * @param {!jspb.BinaryWriter} writer | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.prototype.serializeBinaryToWriter = function (writer) { | proto.helloworld.message.prototype.serializeBinaryToWriter = function (writer) { | ||||||
|   var f = undefined; |   var f = undefined; | ||||||
|   f = this.getProfile(); |   f = this.getMessage(); | ||||||
|   if (f != null) { |   if (f.length > 0) { | ||||||
|     writer.writeMessage( |     writer.writeString( | ||||||
|       1, |       1, | ||||||
|       f, |       f | ||||||
|       proto.user.Profile.serializeBinaryToWriter |  | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * optional Profile profile = 1; |  * optional string name = 1; | ||||||
|  * @return {?proto.user.Profile} |  * @return {string} | ||||||
|  */ |  */ | ||||||
| proto.user.HelloReply.prototype.getProfile = function() { | proto.helloworld.message.prototype.getMessage = function() { | ||||||
|   return /** @type{?proto.user.Profile} */ ( |   return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); | ||||||
|     jspb.Message.getWrapperField(this, proto.user.Profile, 1)); |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** @param {?proto.user.Profile|undefined} value */ | /** @param {string} value */ | ||||||
| proto.user.HelloReply.prototype.setProfile = function(value) { | proto.helloworld.message.prototype.setMessage = function(value) { | ||||||
|   jspb.Message.setWrapperField(this, 1, value); |   jspb.Message.setField(this, 1, value); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| proto.user.HelloReply.prototype.clearProfile = function() { | goog.object.extend(exports, proto.helloworld); | ||||||
|   this.setProfile(undefined); |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Returns whether this field is set. |  | ||||||
|  * @return {!boolean} |  | ||||||
|  */ |  | ||||||
| proto.user.HelloReply.prototype.hasProfile = function() { |  | ||||||
|   return jspb.Message.getField(this, 1) != null; |  | ||||||
| }; |  | ||||||
| // -------------------------------- |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| goog.object.extend(exports, proto.user); |  | ||||||
|   | |||||||
| @@ -1,14 +1,10 @@ | |||||||
| // GENERATED CODE -- DO NOT EDIT! | // GENERATED CODE -- DO NOT EDIT! | ||||||
| {{$Package:=.File.Package}} | {{$Package:=.File.Package}} | ||||||
|  |  | ||||||
| var jspb = require('google-protobuf'); | var jspb = require('google-protobuf'); | ||||||
| var goog = jspb; | var goog = jspb; | ||||||
| var global = Function('return this')(); | var global = Function('return this')(); | ||||||
|  |  | ||||||
| {{range .File.MessageType}} | {{range .File.MessageType}} | ||||||
| goog.exportSymbol('proto.user.{{.Name}}', null, global); | goog.exportSymbol('proto.{{$Package}}.{{.Name}}', null, global);{{end}} | ||||||
| {{end}} |  | ||||||
|  |  | ||||||
| {{range .File.MessageType}} | {{range .File.MessageType}} | ||||||
| /** | /** | ||||||
|  * @param {Array=} opt_data Optional initial data array, typically from a |  * @param {Array=} opt_data Optional initial data array, typically from a | ||||||
| @@ -19,12 +15,12 @@ goog.exportSymbol('proto.user.{{.Name}}', null, global); | |||||||
|  * @extends {jspb.Message} |  * @extends {jspb.Message} | ||||||
|  * @constructor |  * @constructor | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}} = function(opt_data) { | proto.{{$Package}}.{{.Name}} = function(opt_data) { | ||||||
|   jspb.Message.initialize(this, opt_data, 0, -1, null, null); |   jspb.Message.initialize(this, opt_data, 0, -1, null, null); | ||||||
| }; | }; | ||||||
| goog.inherits(proto.user.{{.Name}}, jspb.Message); | goog.inherits(proto.{{$Package}}.{{.Name}}, jspb.Message); | ||||||
| if (goog.DEBUG && !COMPILED) { | if (goog.DEBUG && !COMPILED) { | ||||||
|   proto.user.{{.Name}}.displayName = 'proto.user.{{.Name}}'; |   proto.{{$Package}}.{{.Name}}.displayName = 'proto.{{$Package}}.{{.Name}}'; | ||||||
| } | } | ||||||
|  |  | ||||||
| if (jspb.Message.GENERATE_TO_OBJECT) { | if (jspb.Message.GENERATE_TO_OBJECT) { | ||||||
| @@ -38,8 +34,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { | |||||||
|  *     for transitional soy proto support: http://goto/soy-param-migration |  *     for transitional soy proto support: http://goto/soy-param-migration | ||||||
|  * @return {!Object} |  * @return {!Object} | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.prototype.toObject = function(opt_includeInstance) { | proto.{{$Package}}.{{.Name}}.prototype.toObject = function(opt_includeInstance) { | ||||||
|   return proto.user.{{.Name}}.toObject(opt_includeInstance, this); |   return proto.{{$Package}}.{{.Name}}.toObject(opt_includeInstance, this); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -47,12 +43,12 @@ proto.user.{{.Name}}.prototype.toObject = function(opt_includeInstance) { | |||||||
|  * @param {boolean|undefined} includeInstance Whether to include the JSPB |  * @param {boolean|undefined} includeInstance Whether to include the JSPB | ||||||
|  *     instance for transitional soy proto support: |  *     instance for transitional soy proto support: | ||||||
|  *     http://goto/soy-param-migration |  *     http://goto/soy-param-migration | ||||||
|  * @param {!proto.user.{{.Name}}} msg The msg instance to transform. |  * @param {!proto.{{$Package}}.{{.Name}}} msg The msg instance to transform. | ||||||
|  * @return {!Object} |  * @return {!Object} | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.toObject = function(includeInstance, msg) { | proto.{{$Package}}.{{.Name}}.toObject = function(includeInstance, msg) { | ||||||
|   var f, obj = { |   var f, obj = { | ||||||
|     profile: (f = msg.getProfile()) && proto.user.Profile.toObject(includeInstance, f) |     name: jspb.Message.getFieldWithDefault(msg, 1, "") | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   if (includeInstance) { |   if (includeInstance) { | ||||||
| @@ -65,22 +61,22 @@ proto.user.{{.Name}}.toObject = function(includeInstance, msg) { | |||||||
| /** | /** | ||||||
|  * Deserializes binary data (in protobuf wire format). |  * Deserializes binary data (in protobuf wire format). | ||||||
|  * @param {jspb.ByteSource} bytes The bytes to deserialize. |  * @param {jspb.ByteSource} bytes The bytes to deserialize. | ||||||
|  * @return {!proto.user.{{.Name}}} |  * @return {!proto.{{$Package}}.{{.Name}}} | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.deserializeBinary = function(bytes) { | proto.{{$Package}}.{{.Name}}.deserializeBinary = function(bytes) { | ||||||
|   var reader = new jspb.BinaryReader(bytes); |   var reader = new jspb.BinaryReader(bytes); | ||||||
|   var msg = new proto.user.{{.Name}}; |   var msg = new proto.{{$Package}}.{{.Name}}; | ||||||
|   return proto.user.{{.Name}}.deserializeBinaryFromReader(msg, reader); |   return proto.{{$Package}}.{{.Name}}.deserializeBinaryFromReader(msg, reader); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Deserializes binary data (in protobuf wire format) from the |  * Deserializes binary data (in protobuf wire format) from the | ||||||
|  * given reader into the given message object. |  * given reader into the given message object. | ||||||
|  * @param {!proto.user.{{.Name}}} msg The message object to deserialize into. |  * @param {!proto.{{$Package}}.{{.Name}}} msg The message object to deserialize into. | ||||||
|  * @param {!jspb.BinaryReader} reader The BinaryReader to use. |  * @param {!jspb.BinaryReader} reader The BinaryReader to use. | ||||||
|  * @return {!proto.user.{{.Name}}} |  * @return {!proto.{{$Package}}.{{.Name}}} | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.deserializeBinaryFromReader = function(msg, reader) { | proto.{{$Package}}.{{.Name}}.deserializeBinaryFromReader = function(msg, reader) { | ||||||
|   while (reader.nextField()) { |   while (reader.nextField()) { | ||||||
|     if (reader.isEndGroup()) { |     if (reader.isEndGroup()) { | ||||||
|       break; |       break; | ||||||
| @@ -88,9 +84,8 @@ proto.user.{{.Name}}.deserializeBinaryFromReader = function(msg, reader) { | |||||||
|     var field = reader.getFieldNumber(); |     var field = reader.getFieldNumber(); | ||||||
|     switch (field) { |     switch (field) { | ||||||
|     case 1: |     case 1: | ||||||
|       var value = new proto.user.Profile; |       var value = /** @type {string} */ (reader.readString()); | ||||||
|       reader.readMessage(value,proto.user.Profile.deserializeBinaryFromReader); |       msg.setName(value); | ||||||
|       msg.setProfile(value); |  | ||||||
|       break; |       break; | ||||||
|     default: |     default: | ||||||
|       reader.skipField(); |       reader.skipField(); | ||||||
| @@ -103,10 +98,10 @@ proto.user.{{.Name}}.deserializeBinaryFromReader = function(msg, reader) { | |||||||
| /** | /** | ||||||
|  * Class method variant: serializes the given message to binary data |  * Class method variant: serializes the given message to binary data | ||||||
|  * (in protobuf wire format), writing to the given BinaryWriter. |  * (in protobuf wire format), writing to the given BinaryWriter. | ||||||
|  * @param {!proto.user.{{.Name}}} message |  * @param {!proto.{{$Package}}.{{.Name}}} message | ||||||
|  * @param {!jspb.BinaryWriter} writer |  * @param {!jspb.BinaryWriter} writer | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.serializeBinaryToWriter = function(message, writer) { | proto.{{$Package}}.{{.Name}}.serializeBinaryToWriter = function(message, writer) { | ||||||
|   message.serializeBinaryToWriter(writer); |   message.serializeBinaryToWriter(writer); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -114,63 +109,40 @@ proto.user.{{.Name}}.serializeBinaryToWriter = function(message, writer) { | |||||||
|  * Serializes the message to binary data (in protobuf wire format). |  * Serializes the message to binary data (in protobuf wire format). | ||||||
|  * @return {!Uint8Array} |  * @return {!Uint8Array} | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.prototype.serializeBinary = function() { | proto.{{$Package}}.{{.Name}}.prototype.serializeBinary = function() { | ||||||
|   var writer = new jspb.BinaryWriter(); |   var writer = new jspb.BinaryWriter(); | ||||||
|   this.serializeBinaryToWriter(writer); |   this.serializeBinaryToWriter(writer); | ||||||
|   return writer.getResultBuffer(); |   return writer.getResultBuffer(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | {{range .Field}} | ||||||
| /** | /** | ||||||
|  * Serializes the message to binary data (in protobuf wire format), |  * Serializes the message to binary data (in protobuf wire format), | ||||||
|  * writing to the given BinaryWriter. |  * writing to the given BinaryWriter. | ||||||
|  * @param {!jspb.BinaryWriter} writer |  * @param {!jspb.BinaryWriter} writer | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.prototype.serializeBinaryToWriter = function (writer) { | proto.{{$Package}}.{{.Name}}.prototype.serializeBinaryToWriter = function (writer) { | ||||||
|   var f = undefined; |   var f = undefined; | ||||||
|   f = this.getProfile(); |   f = this.get{{.Name | upperFirst}}(); | ||||||
|   if (f != null) { |   if (f.length > 0) { | ||||||
|     writer.writeMessage( |     writer.writeString( | ||||||
|       1, |       1, | ||||||
|       f, |       f | ||||||
|       proto.user.Profile.serializeBinaryToWriter |  | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * optional Profile profile = 1; |  * optional string name = 1; | ||||||
|  * @return {?proto.user.Profile} |  * @return {string} | ||||||
|  */ |  */ | ||||||
| proto.user.{{.Name}}.prototype.getProfile = function() { | proto.{{$Package}}.{{.Name}}.prototype.get{{.Name | upperFirst}} = function() { | ||||||
|   return /** @type{?proto.user.Profile} */ ( |   return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); | ||||||
|     jspb.Message.getWrapperField(this, proto.user.Profile, 1)); |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| /** @param {?proto.user.Profile|undefined} value */ | /** @param {string} value */ | ||||||
| proto.user.{{.Name}}.prototype.setProfile = function(value) { | proto.{{$Package}}.{{.Name}}.prototype.set{{.Name | upperFirst}} = function(value) { | ||||||
|   jspb.Message.setWrapperField(this, 1, value); |   jspb.Message.setField(this, 1, value); | ||||||
| }; | }; | ||||||
|  | {{end}}{{end}} | ||||||
| proto.user.{{.Name}}.prototype.clearProfile = function() { | goog.object.extend(exports, proto.{{$Package}}); | ||||||
|   this.setProfile(undefined); |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| /** |  | ||||||
|  * Returns whether this field is set. |  | ||||||
|  * @return {!boolean} |  | ||||||
|  */ |  | ||||||
| proto.user.{{.Name}}.prototype.hasProfile = function() { |  | ||||||
|   return jspb.Message.getField(this, 1) != null; |  | ||||||
| }; |  | ||||||
| // -------------------------------- |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| {{end}} |  | ||||||
|  |  | ||||||
| goog.object.extend(exports, proto.user); |  | ||||||
|   | |||||||
| @@ -31,6 +31,9 @@ var ProtoHelpersFuncMap = template.FuncMap{ | |||||||
| 	"last": func(a []string) string { | 	"last": func(a []string) string { | ||||||
| 		return a[len(a)-1] | 		return a[len(a)-1] | ||||||
| 	}, | 	}, | ||||||
|  | 	"upperFirst": func(s string) string { | ||||||
|  | 		return strings.ToUpper(s[:1]) + s[1:] | ||||||
|  | 	}, | ||||||
| 	"lowerFirst": func(s string) string { | 	"lowerFirst": func(s string) string { | ||||||
| 		return strings.ToLower(s[:1]) + s[1:] | 		return strings.ToLower(s[:1]) + s[1:] | ||||||
| 	}, | 	}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user