Source: proto/spine/people/person_name_pb.js

  1. // source: spine/people/person_name.proto
  2. /**
  3. * @fileoverview
  4. * @enhanceable
  5. * @suppress {messageConventions} JS Compiler reports an error if a variable or
  6. * field starts with 'MSG_' and isn't a translatable message.
  7. * @public
  8. */
  9. // GENERATED CODE -- DO NOT EDIT!
  10. var jspb = require('google-protobuf');
  11. var goog = jspb;
  12. var global = Function('return this')();
  13. var spine_options_pb = require('../../spine/options_pb.js');
  14. goog.object.extend(proto, spine_options_pb);
  15. goog.exportSymbol('proto.spine.people.PersonName', null, global);
  16. /**
  17. * Generated by JsPbCodeGenerator.
  18. * @param {Array=} opt_data Optional initial data array, typically from a
  19. * server response, or constructed directly in Javascript. The array is used
  20. * in place and becomes part of the constructed object. It is not cloned.
  21. * If no data is provided, the constructed object will be empty, but still
  22. * valid.
  23. * @extends {jspb.Message}
  24. * @constructor
  25. */
  26. proto.spine.people.PersonName = function(opt_data) {
  27. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  28. };
  29. goog.inherits(proto.spine.people.PersonName, jspb.Message);
  30. if (goog.DEBUG && !COMPILED) {
  31. /**
  32. * @public
  33. * @override
  34. */
  35. proto.spine.people.PersonName.displayName = 'proto.spine.people.PersonName';
  36. }
  37. if (jspb.Message.GENERATE_TO_OBJECT) {
  38. /**
  39. * Creates an object representation of this proto.
  40. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  41. * Optional fields that are not set will be set to undefined.
  42. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  43. * For the list of reserved names please see:
  44. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  45. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  46. * JSPB instance for transitional soy proto support:
  47. * http://goto/soy-param-migration
  48. * @return {!Object}
  49. */
  50. proto.spine.people.PersonName.prototype.toObject = function(opt_includeInstance) {
  51. return proto.spine.people.PersonName.toObject(opt_includeInstance, this);
  52. };
  53. /**
  54. * Static version of the {@see toObject} method.
  55. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  56. * the JSPB instance for transitional soy proto support:
  57. * http://goto/soy-param-migration
  58. * @param {!proto.spine.people.PersonName} msg The msg instance to transform.
  59. * @return {!Object}
  60. * @suppress {unusedLocalVariables} f is only used for nested messages
  61. */
  62. proto.spine.people.PersonName.toObject = function(includeInstance, msg) {
  63. var f, obj = {
  64. honorificPrefix: jspb.Message.getFieldWithDefault(msg, 1, ""),
  65. givenName: jspb.Message.getFieldWithDefault(msg, 2, ""),
  66. middleName: jspb.Message.getFieldWithDefault(msg, 3, ""),
  67. familyName: jspb.Message.getFieldWithDefault(msg, 4, ""),
  68. honorificSuffix: jspb.Message.getFieldWithDefault(msg, 5, "")
  69. };
  70. if (includeInstance) {
  71. obj.$jspbMessageInstance = msg;
  72. }
  73. return obj;
  74. };
  75. }
  76. /**
  77. * Deserializes binary data (in protobuf wire format).
  78. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  79. * @return {!proto.spine.people.PersonName}
  80. */
  81. proto.spine.people.PersonName.deserializeBinary = function(bytes) {
  82. var reader = new jspb.BinaryReader(bytes);
  83. var msg = new proto.spine.people.PersonName;
  84. return proto.spine.people.PersonName.deserializeBinaryFromReader(msg, reader);
  85. };
  86. /**
  87. * Deserializes binary data (in protobuf wire format) from the
  88. * given reader into the given message object.
  89. * @param {!proto.spine.people.PersonName} msg The message object to deserialize into.
  90. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  91. * @return {!proto.spine.people.PersonName}
  92. */
  93. proto.spine.people.PersonName.deserializeBinaryFromReader = function(msg, reader) {
  94. while (reader.nextField()) {
  95. if (reader.isEndGroup()) {
  96. break;
  97. }
  98. var field = reader.getFieldNumber();
  99. switch (field) {
  100. case 1:
  101. var value = /** @type {string} */ (reader.readString());
  102. msg.setHonorificPrefix(value);
  103. break;
  104. case 2:
  105. var value = /** @type {string} */ (reader.readString());
  106. msg.setGivenName(value);
  107. break;
  108. case 3:
  109. var value = /** @type {string} */ (reader.readString());
  110. msg.setMiddleName(value);
  111. break;
  112. case 4:
  113. var value = /** @type {string} */ (reader.readString());
  114. msg.setFamilyName(value);
  115. break;
  116. case 5:
  117. var value = /** @type {string} */ (reader.readString());
  118. msg.setHonorificSuffix(value);
  119. break;
  120. default:
  121. reader.skipField();
  122. break;
  123. }
  124. }
  125. return msg;
  126. };
  127. /**
  128. * Serializes the message to binary data (in protobuf wire format).
  129. * @return {!Uint8Array}
  130. */
  131. proto.spine.people.PersonName.prototype.serializeBinary = function() {
  132. var writer = new jspb.BinaryWriter();
  133. proto.spine.people.PersonName.serializeBinaryToWriter(this, writer);
  134. return writer.getResultBuffer();
  135. };
  136. /**
  137. * Serializes the given message to binary data (in protobuf wire
  138. * format), writing to the given BinaryWriter.
  139. * @param {!proto.spine.people.PersonName} message
  140. * @param {!jspb.BinaryWriter} writer
  141. * @suppress {unusedLocalVariables} f is only used for nested messages
  142. */
  143. proto.spine.people.PersonName.serializeBinaryToWriter = function(message, writer) {
  144. var f = undefined;
  145. f = message.getHonorificPrefix();
  146. if (f.length > 0) {
  147. writer.writeString(
  148. 1,
  149. f
  150. );
  151. }
  152. f = message.getGivenName();
  153. if (f.length > 0) {
  154. writer.writeString(
  155. 2,
  156. f
  157. );
  158. }
  159. f = message.getMiddleName();
  160. if (f.length > 0) {
  161. writer.writeString(
  162. 3,
  163. f
  164. );
  165. }
  166. f = message.getFamilyName();
  167. if (f.length > 0) {
  168. writer.writeString(
  169. 4,
  170. f
  171. );
  172. }
  173. f = message.getHonorificSuffix();
  174. if (f.length > 0) {
  175. writer.writeString(
  176. 5,
  177. f
  178. );
  179. }
  180. };
  181. /**
  182. * optional string honorific_prefix = 1;
  183. * @return {string}
  184. */
  185. proto.spine.people.PersonName.prototype.getHonorificPrefix = function() {
  186. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
  187. };
  188. /**
  189. * @param {string} value
  190. * @return {!proto.spine.people.PersonName} returns this
  191. */
  192. proto.spine.people.PersonName.prototype.setHonorificPrefix = function(value) {
  193. return jspb.Message.setProto3StringField(this, 1, value);
  194. };
  195. /**
  196. * optional string given_name = 2;
  197. * @return {string}
  198. */
  199. proto.spine.people.PersonName.prototype.getGivenName = function() {
  200. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
  201. };
  202. /**
  203. * @param {string} value
  204. * @return {!proto.spine.people.PersonName} returns this
  205. */
  206. proto.spine.people.PersonName.prototype.setGivenName = function(value) {
  207. return jspb.Message.setProto3StringField(this, 2, value);
  208. };
  209. /**
  210. * optional string middle_name = 3;
  211. * @return {string}
  212. */
  213. proto.spine.people.PersonName.prototype.getMiddleName = function() {
  214. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
  215. };
  216. /**
  217. * @param {string} value
  218. * @return {!proto.spine.people.PersonName} returns this
  219. */
  220. proto.spine.people.PersonName.prototype.setMiddleName = function(value) {
  221. return jspb.Message.setProto3StringField(this, 3, value);
  222. };
  223. /**
  224. * optional string family_name = 4;
  225. * @return {string}
  226. */
  227. proto.spine.people.PersonName.prototype.getFamilyName = function() {
  228. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
  229. };
  230. /**
  231. * @param {string} value
  232. * @return {!proto.spine.people.PersonName} returns this
  233. */
  234. proto.spine.people.PersonName.prototype.setFamilyName = function(value) {
  235. return jspb.Message.setProto3StringField(this, 4, value);
  236. };
  237. /**
  238. * optional string honorific_suffix = 5;
  239. * @return {string}
  240. */
  241. proto.spine.people.PersonName.prototype.getHonorificSuffix = function() {
  242. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
  243. };
  244. /**
  245. * @param {string} value
  246. * @return {!proto.spine.people.PersonName} returns this
  247. */
  248. proto.spine.people.PersonName.prototype.setHonorificSuffix = function(value) {
  249. return jspb.Message.setProto3StringField(this, 5, value);
  250. };
  251. goog.object.extend(exports, proto.spine.people);
  252. // Generated by Spine ProtoJs Plugin
  253. let ObjectParser = require('../../../client/parser/object-parser.js').default;
  254. let TypeParsers = require('../../../client/parser/type-parsers.js').default;
  255. proto.spine.people.PersonName.Parser = function() {
  256. ObjectParser.call(this);
  257. };
  258. proto.spine.people.PersonName.Parser.prototype = Object.create(ObjectParser.prototype);
  259. proto.spine.people.PersonName.Parser.prototype.constructor = proto.spine.people.PersonName.Parser;
  260. proto.spine.people.PersonName.Parser.prototype.fromObject = function(obj) {
  261. if (obj === null) {
  262. return null;
  263. }
  264. let msg = new proto.spine.people.PersonName();
  265. if (obj.honorificPrefix !== undefined) {
  266. if (obj.honorificPrefix !== null) {
  267. let value = obj.honorificPrefix;
  268. msg.setHonorificPrefix(value);
  269. }
  270. }
  271. if (obj.givenName !== undefined) {
  272. if (obj.givenName !== null) {
  273. let value = obj.givenName;
  274. msg.setGivenName(value);
  275. }
  276. }
  277. if (obj.middleName !== undefined) {
  278. if (obj.middleName !== null) {
  279. let value = obj.middleName;
  280. msg.setMiddleName(value);
  281. }
  282. }
  283. if (obj.familyName !== undefined) {
  284. if (obj.familyName !== null) {
  285. let value = obj.familyName;
  286. msg.setFamilyName(value);
  287. }
  288. }
  289. if (obj.honorificSuffix !== undefined) {
  290. if (obj.honorificSuffix !== null) {
  291. let value = obj.honorificSuffix;
  292. msg.setHonorificSuffix(value);
  293. }
  294. }
  295. return msg;
  296. };
  297. // Generated by Spine ProtoJs Plugin
  298. proto.spine.people.PersonName.typeUrl = function() {
  299. return 'type.spine.io/spine.people.PersonName';
  300. };